This has been bugging the crap out of me for ages, and before someone says, "build it yourself" i will look into it, & don;t say upgrade as it is not possible for me to do so, as of this moment but:
Why does the admin not receive a notification email when a return has happend?
It doesn't even have to be a substantial email, just you have a returns request waiting, or something like that!
How is the admin suppose to know when a return request has happened, to me this seems there is no point having a returns system unless this happens, because i categorically guarantee the any clients using the system will not actively go a nd check, even if i gave them a bullet point list of things to do everyday when checking the back office, i've already seen it happen. And before someone says some wise crack about having stupid clients, ask yourself what my clients ask me, "why don't i get an email about a return?"
Which has led me here to ask?
It just seems like the most important thing for returns, so it can be processed has been missed out, can anyone shed some light on this or has anyone tried to fix this?
Cheers Guys
Chris
Why does the admin not receive a notification email when a return has happend?
It doesn't even have to be a substantial email, just you have a returns request waiting, or something like that!
How is the admin suppose to know when a return request has happened, to me this seems there is no point having a returns system unless this happens, because i categorically guarantee the any clients using the system will not actively go a nd check, even if i gave them a bullet point list of things to do everyday when checking the back office, i've already seen it happen. And before someone says some wise crack about having stupid clients, ask yourself what my clients ask me, "why don't i get an email about a return?"
Which has led me here to ask?
It just seems like the most important thing for returns, so it can be processed has been missed out, can anyone shed some light on this or has anyone tried to fix this?
Cheers Guys
Chris
Last edited by webpie it. on Fri Aug 05, 2011 1:31 pm, edited 3 times in total.
Regards
Chris
Hi, Chris. I have been thinking about this for some time. Admin should indeed get email notification when a return request is submitted! But I am not a coder and changing the code is far beyond me.
However, someone in the past made a little mod to notify admin when a new review is inserted.
I hope this will shed some light.
check the post here:
http://forum.opencart.com/viewtopic.php ... dit#p74324
If you have managed to do it, please share the codes if possible.
Lots of people need this notification function, including me
Marcel
However, someone in the past made a little mod to notify admin when a new review is inserted.
I hope this will shed some light.
check the post here:
http://forum.opencart.com/viewtopic.php ... dit#p74324
If you have managed to do it, please share the codes if possible.
Lots of people need this notification function, including me

Marcel
"We help each other to grow". That's the opencart community!
All free mods
Home Based Ebay business Opportunity(not ads)
Followed you suggestion to look at the old post, basically here at the moment thanks to jcsmithy as usual!:
On V 1.5.0.5 the admin will now get an email if a review is posted about any product.
Inserted this into catalog/model/catalog/review.php
Find:
Add:
UPdate the above parts in the code to your site of course.
Working on the returns one, but as the logic is the same just got to update a few things, but will post when i get it right!
Chris
On V 1.5.0.5 the admin will now get an email if a review is posted about any product.
Inserted this into catalog/model/catalog/review.php
Find:
Code: Select all
<?php
class ModelCatalogReview extends Model {
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()");
}
Code: Select all
<?php
class ModelCatalogReview extends Model {
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()");
[highlight]$message ="<strong>You have a new product review waiting.</strong><br><br>"
.$data['text']."<br>"
.'<a href="http://YOURSITEHERE.COM/">Login to review</a>';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom("YOUREMAIL@MAIL.COM");
$mail->setSender("NAME OF SHOP HERE");
$mail->setSubject("Product Review");
$mail->setHtml(strip_tags(html_entity_decode($message, ENT_QUOTES, 'UTF-8')));
$mail->send();[/highlight]
}
Working on the returns one, but as the logic is the same just got to update a few things, but will post when i get it right!
Chris
Regards
Chris
Ok Got the returns email alert working with masive help from JCSMITHY! AGAIN! lol
Find:
/catalog/controller/account/return.php
Line 312 on mine
Add below:
I have tested this on 1.5.0.5 and works perfect!
This should Be all you need!
Thanks JCSMITHY!
Find:
/catalog/controller/account/return.php
Line 312 on mine
Code: Select all
public function insert() {
$this->language->load('account/return');
$this->load->model('account/return');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_account_return->addReturn($this->request->post);
$this->redirect($this->url->link('account/return/success', '', 'SSL'));
}
Code: Select all
public function insert() {
$this->language->load('account/return');
$this->load->model('account/return');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_account_return->addReturn($this->request->post);
[highlight]$message ="<strong>You have a product return waiting.</strong><br><br>"
.'<a href="http://YOURWEBSITE.COM/ADMIN">Login to review</a>';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom("YOUREMAIL@mail.com");
$mail->setSender("SENDER NAME HERE");
$mail->setSubject("A Return Has Been Requested");
$mail->setHtml($message);
$mail->send();[/highlight]
$this->redirect($this->url->link('account/return/success', '', 'SSL'));
}
This should Be all you need!
Thanks JCSMITHY!
Regards
Chris
works like a charm!
"We help each other to grow". That's the opencart community!
All free mods
Home Based Ebay business Opportunity(not ads)
By the way, if you guys want to have email alerts for new affiliate account signed up waiting to be approved.
Do this:
open catalog\controller\affiliate\success.php
Find
After it, insert:
Do this:
open catalog\controller\affiliate\success.php
Find
Code: Select all
$this->response->setOutput($this->render());
Code: Select all
$message ="<strong>You have a new affiliate waiting to be approved.</strong><br><br>"
.'<a href="http://www.YOURSITE.com/admin/">Login to review</a>';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom("YOUREMAIL@YOURSITE.COM");
$mail->setSender("YOURSITE.com");
$mail->setSubject("An Affiliate Account Has Been Requested");
$mail->setHtml($message);
$mail->send();
"We help each other to grow". That's the opencart community!
All free mods
Home Based Ebay business Opportunity(not ads)
Hi Chriswebpie it. wrote:Followed you suggestion to look at the old post, basically here at the moment thanks to jcsmithy as usual!:
On V 1.5.0.5 the admin will now get an email if a review is posted about any product.
Inserted this into catalog/model/catalog/review.php
Find:Add:Code: Select all
<?php class ModelCatalogReview extends Model { 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()"); }
UPdate the above parts in the code to your site of course.Code: Select all
<?php class ModelCatalogReview extends Model { 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()"); [highlight]$message ="<strong>You have a new product review waiting.</strong><br><br>" .$data['text']."<br>" .'<a href="http://YOURSITEHERE.COM/">Login to review</a>'; $mail = new Mail(); $mail->protocol = $this->config->get('config_mail_protocol'); $mail->parameter = $this->config->get('config_mail_parameter'); $mail->hostname = $this->config->get('config_smtp_host'); $mail->username = $this->config->get('config_smtp_username'); $mail->password = $this->config->get('config_smtp_password'); $mail->port = $this->config->get('config_smtp_port'); $mail->timeout = $this->config->get('config_smtp_timeout'); $mail->setTo($this->config->get('config_email')); $mail->setFrom("YOUREMAIL@MAIL.COM"); $mail->setSender("NAME OF SHOP HERE"); $mail->setSubject("Product Review"); $mail->setHtml(strip_tags(html_entity_decode($message, ENT_QUOTES, 'UTF-8'))); $mail->send();[/highlight] }
Working on the returns one, but as the logic is the same just got to update a few things, but will post when i get it right!
Chris
So have you applied this change and got this working in your 1.5.05 then, as everytime I try to make this change in catalog/model/catalog/review.php I am hit with this site error
Parse error: syntax error, unexpected '[' in /home/vwgolfm/public_html/shop/catalog/model/catalog/review.php on line 6
Line 6 in that file is where this part of the code starts
Code: Select all
[highlight]$message ="<strong>You have a new product review waiting.</strong><br><br>"
Here is my review.php file
Code: Select all
<?php
class ModelCatalogReview extends Model {
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()");
[highlight]$message ="<strong>You have a new product review waiting.</strong><br><br>"
.$data['text']."<br>"
.'<a href="http://sitename.org.uk/">Login to review</a>';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom("webmaster@sitename.org.uk");
$mail->setSender("Shop");
$mail->setSubject("Product Review");
$mail->setHtml(strip_tags(html_entity_decode($message, ENT_QUOTES, 'UTF-8')));
$mail->send();[/highlight]
}
public function getReviewsByProductId($product_id, $start = 0, $limit = 20) {
$query = $this->db->query("SELECT r.review_id, r.author, r.rating, r.text, p.product_id, pd.name, p.price, p.image, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY r.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
return $query->rows;
}
public function getAverageRating($product_id) {
$query = $this->db->query("SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review WHERE status = '1' AND product_id = '" . (int)$product_id . "' GROUP BY product_id");
if (isset($query->row['total'])) {
return (int)$query->row['total'];
} else {
return 0;
}
}
public function getTotalReviews() {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) WHERE p.date_available <= NOW() AND p.status = '1' AND r.status = '1'");
return $query->row['total'];
}
public function getTotalReviewsByProductId($product_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
return $query->row['total'];
}
}
?>
I also get a similar error when trying to make the other change for the returns email modification, am i just being stupid

Thanks Mark
For the price of a beer in London my extension does this and also adds alerts to the dashboard
see -> http://www.opencart.com/index.php?route ... order=DESC
see -> http://www.opencart.com/index.php?route ... order=DESC
Hi mark so sorry for missing this one, i will complete your review.php with mine and see if there is an error, as i can confirm this does work!:)
Get back to you real soon!
Though just saw uksb, i have to agree his mod does this and a lot more.
Get back to you real soon!
Though just saw uksb, i have to agree his mod does this and a lot more.
Regards
Chris
Simon (Uksitebuilder)
Are you the same person who assisted me with the start up of my site all them years ago, it is a bulldog forum and I started out on php-nuke and you helped (maybe still do) the mk2 golf owners club.
If not just ignore me.
I have just had a look at your module, which looks very good, and very reasonably priced, but I don`t think I will need to alerts on the dashboard if I can just get the admin email notification for these returns and reviews, if I can`t get the code working then I will buy the module.
But if webpie has got his working with no errors I will have a go that way first
Thanks Mark
Are you the same person who assisted me with the start up of my site all them years ago, it is a bulldog forum and I started out on php-nuke and you helped (maybe still do) the mk2 golf owners club.
If not just ignore me.
I have just had a look at your module, which looks very good, and very reasonably priced, but I don`t think I will need to alerts on the dashboard if I can just get the admin email notification for these returns and reviews, if I can`t get the code working then I will buy the module.
But if webpie has got his working with no errors I will have a go that way first
Thanks Mark
Yep a very small world ha.
I actually help the mk1 golf owners club and this is who the opencart store is for.
My little site still has that logo you created for it.
Anyway I will get back to you if can`t figure out a fix for this little email issue
I actually help the mk1 golf owners club and this is who the opencart store is for.
My little site still has that logo you created for it.
Anyway I will get back to you if can`t figure out a fix for this little email issue
Code: Select all
<?php
class ModelCatalogReview extends Model {
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()");
$message ="<strong>You have a new product review waiting.</strong><br><br>"
.$data['text']."<br>"
.'<a href="http://sitename.org.uk/">Login to review</a>';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom("webmaster@sitename.org.uk");
$mail->setSender("Shop");
$mail->setSubject("Product Review");
$mail->setHtml(strip_tags(html_entity_decode($message, ENT_QUOTES, 'UTF-8')));
$mail->send();
}
public function getReviewsByProductId($product_id, $start = 0, $limit = 20) {
$query = $this->db->query("SELECT r.review_id, r.author, r.rating, r.text, p.product_id, pd.name, p.price, p.image, r.date_added FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY r.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);
return $query->rows;
}
public function getAverageRating($product_id) {
$query = $this->db->query("SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review WHERE status = '1' AND product_id = '" . (int)$product_id . "' GROUP BY product_id");
if (isset($query->row['total'])) {
return (int)$query->row['total'];
} else {
return 0;
}
}
public function getTotalReviews() {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) WHERE p.date_available <= NOW() AND p.status = '1' AND r.status = '1'");
return $query->row['total'];
}
public function getTotalReviewsByProductId($product_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
return $query->row['total'];
}
}
?>
all i have done, which i should have done beofre is remove the [ highlight ][ /highlight ]
Rookie error pointed out by jcsmithy!! lol
Chris
Regards
Chris
For returns follow what put i put above about returns.php but where you see[ highlight] and [\ highlight] remove these both and it should work.
Exact same error as review above:
Sorry my mistake!!
Exact same error as review above:
Sorry my mistake!!
Regards
Chris
Many thanks for this - just added it to my 1.5.1.3 install and it works like a charm.webpie it. wrote:Ok Got the returns email alert working with masive help from JCSMITHY! AGAIN! lol
...
...
I have tested this on 1.5.0.5 and works perfect!
This should Be all you need!
Thanks JCSMITHY!
Who is online
Users browsing this forum: Bing [Bot] and 19 guests