PDA

View Full Version : Review Notification



michael_s
04-26-2011, 08:00 AM
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!

More... (http://addons.oscommerce.com/info/1904)