First find (and backup)
/catalogue/model/catalogue/review.php
Before line 5 press enter and paste the code below, replacing with your email:
Code: Select all
return mail("EXAMPLE@EXAMPLEMAIL.COM","New product Review","You have a new product review waiting. Log in to review it.");
Screenshots:
Before:

After:

Result:

C A R
---
Environment
php: 7.4.33
Browser: Chrome latest
---
OpenCart
2.3.0.2 singlestore (bugfree edition by xxvirusxx: https://github.com/condor2/Opencart_2302)
DE language by OSWorX (https://www.opencart.com/index.php?rout ... n_id=31048)
Template: Sellmore by 321cart
quite a few Extensions :-)
Code: Select all
return mail("EXAMPLE@EXAMPLEMAIL.COM","New product Review","You have a new product review waiting. Log in to review it.", "From:admin@mystore.com");
Thanks very much it work great!!!
A question maybe you can help me with and similar to this:
In my sotre I only have the option of paying when receiving the products, so when a customer place an order, check the option Pay when receiving products and confirm order, the order is placed. But I don't receive an e-mail ntifying me about that new order, so I can broke the agreement of deliver in 24 hours because I don't know when a new order is placed.
Note: I have thisoption: Send a email to the store owner when a new order is created set to YES in:
Admin, Configuration, Settins, Option.
What can I do??
Wilma
(Don't speak english)
I have updated the above script to include the users review directly in the email. This way if the review is needless garbage, you can wait to deal with it later.

I also added a link to the admin page for convenience.
Don't forget to change the Email address and edit the path to the admin area. -=:@:=-
Code: Select all
return mail(
"EXAMPLE@EXAMPLEMAIL.COM",
"New product Review",
"You have a new product review waiting.<br>".
$this->db->escape(strip_tags($data['text']))."<br>".
'<a href="http://YOURSITE.com/admin/index.php">Login to review</a>'
);
»-(¯`·.·´¯)->"The most wasted day in that in which we have not laughed."<-(¯`·.·´¯)-«
ThanksYou have a new product review waiting.<br>adaad adfgadhadfdhdahahahaaaah<br><a href="http://digitalchaosprints.biz/admin/index.php">Login to review</a>
The most terrifying words in the English language are: I'm from the government and I'm here to help.
Ronald Reagan
Digital Chaos | Graphic Design Studio http://www.digitalchaos.biz
Digital Chaos Prints | Custom Art Prints http://www.digitalchaosprints.biz
My bad. I posted the wrong code.

Use this on the file catalog/model/catalog/review.php
Make a space on line 5 just before the closing '}' and place the code there.
This is using OpenCart's own Mail class, so it should work on most sites. [as seen in catalog/model/checkout/order.php] I replaced the 'setText' with 'setHtml'. and replaced some of the variables [setTo, setFrom, setSender, setSubject] with quoted strings.
Remember to change the LINK and EMAIL setting to fit your site. -=:@:=-
Code: Select all
$message ="<strong>You have a new product review waiting.</strong><br><br>"
.$this->db->escape(strip_tags($data['text']))."<br>"
.'<a href="http://YOURSITE.com/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("EXAMPLE@ EXAMPLE.com");
$mail->setFrom("EXAMPLE@ EXAMPLE.com");
$mail->setSender("admin");
$mail->setSubject("Product Review");
$mail->setHtml($message);
$mail->send();
»-(¯`·.·´¯)->"The most wasted day in that in which we have not laughed."<-(¯`·.·´¯)-«
The most terrifying words in the English language are: I'm from the government and I'm here to help.
Ronald Reagan
Digital Chaos | Graphic Design Studio http://www.digitalchaos.biz
Digital Chaos Prints | Custom Art Prints http://www.digitalchaosprints.biz
What I would like to see is a way of excepting or rejecting a review right from the email.
But that is beyond my capability right now -=:@:=-
»-(¯`·.·´¯)->"The most wasted day in that in which we have not laughed."<-(¯`·.·´¯)-«
this is great - thanks a lot!
---
Environment
php: 7.4.33
Browser: Chrome latest
---
OpenCart
2.3.0.2 singlestore (bugfree edition by xxvirusxx: https://github.com/condor2/Opencart_2302)
DE language by OSWorX (https://www.opencart.com/index.php?rout ... n_id=31048)
Template: Sellmore by 321cart
quite a few Extensions :-)
How to modify so that the customer (after login) that has bought the specified product can write the reviews ?
May be the Write Review form for this product will shown if he has bought that product, and he can only see the reviews WITHOUT form, if he has not bought this product.
Thanks in advance.
- pedma -
Thanks.
So for those who would like to use it, just copy the following lines to the file catalog/model/catalog/review.php at the end of the method addReview()
Code: Select all
$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();
Benjamin
--------------------------------------------------------
Bar54 | Toys in Capetown | Catering in Stuttgart
Users browsing this forum: No registered users and 21 guests