Contributions

Features (Category Index)
Search: 

Review Notification

This is a simple modification that will send an email when a new review has been written. It should work whether you have the Review Approval mod installed or not.

The recipient of the email is designated via the admin control panel

Expand All / Collapse All

Added product name and cleaned instructions. Full package. 26 Apr 2011

Minor changes:

Changed output to show product's name as well as the model number.
Cleaned output format.
Cleaned the installation instructions which were confusing and had retained remnants of obsolete instruction.
No download required; the text below is the full mod. All credit goes to the original author(s).

-----------------------------------------------

INSTALLATION:

1) Backup the file: catalog/product_reviews_write.php as it's the only file you will need to change.

2) In catalog/product_reviews_write.php (at or near line 30), find:

$customer_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

*** Replace with:

// notify by email mod replacement
// $customer_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$customer_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_email_address, a.entry_company from " . TABLE_CUSTOMERS . " c LEFT JOIN " .TABLE_ADDRESS_BOOK. " a ON a.customers_id = c.customers_id where c.customers_id = '" . (int)$customer_id . "'");
// end of notify by email mod replacement

3) In the same file, just after this line (at or near line 65):

tep_db_query("insert into " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text) values ('" . $insert_id . "', '" . $languages_id . "', '" . $HTTP_POST_VARS['review'] . "')");

*** ADD the following:

// notify by email mod insertion
$email_notify_body =
'A new review has been submitted by: '."n".
'Name: '. $customer['customers_firstname'] . " " . $customer['customers_lastname']."n".
"Company: ".$customer['entry_company']."n".
"Email: " .$customer['customers_email_address']."nn".
"----------------------------------------------"."n".
"Product: " .$product_info['products_name']."n".
"Model: " .$product_info['products_model']."n".
"Review Text:"."n".
$review."n"
;

tep_mail('', STORE_OWNER_EMAIL_ADDRESS, '*** New Review',$email_notify_body, '',STORE_OWNER_EMAIL_ADDRESS , '');
// end of notify by email mod insertion

4) Test it! You're done!

-----------------------------------------------

Remember, even though this is a simple fix you should ALWAYS BACKUP YOUR FILES FIRST!

Detailed email notification on review 1 May 2009
review_email corrected and simplified Ethan Shalev 11 Mar 2004
Review Notification S. David Ferrise 25 Feb 2004

Note: Contributions are used at own risk.