Page 2 of 2
Re: reviews moderation
Posted: Sat Oct 22, 2011 4:46 am
by dizarter
I am amazed a version of this has not been implemented yet!
I vote that there should be an option in the store admin to enable review notifications on and off.
It will be a huge plus to the product reviewal system.
Just my $0.02 anyways.
Re: reviews moderation
Posted: Fri Jan 27, 2012 6:51 pm
by baha90210
Hi Guys,
Great job, although I think that the model tier is just for doing database stuff.
The model tier would be a better place to send out mails.
That's why I'm posting another version of the code.
In catalog/model/catalog/review.php, replace
Code: Select all
public function addReview($product_id, $data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', date_added = NOW()");
}
with
Code: Select all
public function addReview($product_id, $data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '1', date_added = NOW()");
}
This wil auto-approve every review.
In catalog/controller/product/product.php, add
Code: Select all
$data = $this->request->post;
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
$message ="<strong>You have a new product review waiting.</strong><br><br>";
$message.='Product: '.$this->db->escape(strip_tags($product_info['name'])).'<br>';
$message.='Reviewer: '.$this->db->escape(strip_tags($data['name'])).'<br>';
$message.='Rating: '.$this->db->escape(strip_tags($data['rating'])).'<br><br>';
$message.='Text: <br>';
$message.=$this->db->escape(strip_tags($data['text']))."<br><br>";
$message.='<a href="'.$this->config->get('config_url').'/admin/index.php">Login to review</a>';
$mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password')), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
$mail->setTo(array($this->config->get('config_email')));
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject("Product Review");
$mail->setHtml($message);
$mail->send();
right below
Code: Select all
if (($this->request->server['REQUEST_METHOD'] == 'POST') && !isset($json['error'])) {
$this->model_catalog_review->addReview($this->request->get['product_id'], $this->request->post);
$json['success'] = $this->language->get('text_success');
This wil send an email to the shop owner when a review has been submitted.
Grtz,
Bart
Re: reviews moderation
Posted: Wed Feb 01, 2012 5:59 am
by Concept211
I went ahead and converted this to a vQmod for v1.5.1.3:
http://www.opencart.com/index.php?route ... on_id=4828
Hope it helps someone!
Re: reviews moderation
Posted: Thu May 10, 2012 7:27 pm
by URAGANU
Can you adapt it to latest version of OC ?
Thanks for efforts.
Re: reviews moderation
Posted: Wed Jun 13, 2012 5:57 am
by Wade C
What would be involved with making a VqMOD like this for getting email notification when a customer submits a return request?
Been reading up on that and seems the only VqMOD out there is for newer versions, and Im not ready to upgrade yet.
Hoping to get email notifications from the system when a customer submits a return. (Honestly, cant believe it needs to be a mod - and not part of the core stuff - but not my baby so not my call either)
Thanks
Wade
Re: reviews moderation
Posted: Sat Jul 07, 2012 6:53 am
by Cartyhe
benjamin wrote:I have further improved the code to use the shop configuration instead of hardcoding the email, shop name, etc. ...
Hi Benjamin. Would you say this works in version 1.5.3.1? I tested it and I get no email, whatsoever. I pasted the bit of code after the ';' so it's between ';' and '}', correct?