View Single Post
  #2  
Old 11-23-2006, 01:54 PM
  ShishaPipeUK's Avatar 
ShishaPipeUK ShishaPipeUK is offline
 

Senior Member
  
Join Date: Jul 2005
Location: London, England.
Posts: 118
 

Lightbulb Re: Notify me when the product's information, price and stock level is changed

Now to the five original xcart 4.1.3 files to be changed:

include/import_products.php

Look for this code:

Code:
# Direct import $is_new = ($_productid === false); if (!empty($data)) { $data = func_addslashes($data); if ($_productid === false) { $data['provider'] = $import_data_provider; $_productid = func_array2insert("products", $data); } else { func_array2update("products", $data, "productid = '$_productid'"); } }

replace it with:

Code:
# Direct import $is_new = ($_productid === false); if (!empty($data)) { $data = func_addslashes($data); if ($_productid === false) { $data['provider'] = $import_data_provider; $_productid = func_array2insert("products", $data); } else { # START: SHISHAPIPE UK MOD - theshisha.com # Check email for changed product $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid'"); if ($notify_emails){ foreach($notify_emails as $v){ $old_product_data = func_query_first("SELECT * FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid' AND email='$v[email]'"); if ($old_product_data["descr"] != $query_data["descr"] || $old_product_data["fulldescr"] != $query_data["fulldescr"] || $old_product_data["avail"] != $query_data["avail"]){ global $mail_smarty; $mail_smarty->assign("productid", $_productid); $mail_smarty->assign("email", $v["email"]); func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false); db_query("UPDATE $sql_tbl[email_for_changed_products] SET descr='".addslashes($data["descr"])."', fulldescr='".addslashes($data["fulldescr"])."', avail='$data[avail]' WHERE productid='$_productid' AND email='$v[email]'"); } } } # /Check email for changed product # END: SHISHAPIPE UK MOD - theshisha.com func_array2update("products", $data, "productid = '$_productid'"); } }

Then look for this code in the same file include/import_products.php :

Code:
# Import price if (isset($product['price']) || $is_new) { $product['price'] = doubleval($product['price']); $priceid = func_query_first_cell("SELECT priceid FROM $sql_tbl[pricing] WHERE productid = '$_productid' AND quantity = 1 AND membershipid = 0 AND variantid = 0"); if ($priceid) { func_array2update("pricing", array("price" => $product['price']), "priceid = '$priceid'");

And replace it with:

Code:
# Import price if (isset($product['price']) || $is_new) { $product['price'] = doubleval($product['price']); $priceid = func_query_first_cell("SELECT priceid FROM $sql_tbl[pricing] WHERE productid = '$_productid' AND quantity = 1 AND membershipid = 0 AND variantid = 0"); if ($priceid) { # START: SHISHAPIPE UK MOD - theshisha.com # Check email for changed product $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid'"); if ($notify_emails){ foreach($notify_emails as $v){ $old_product_price = func_query_first_cell("SELECT price FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid' AND email='$v[email]'"); if ($old_product_price != $product['price']){ global $mail_smarty; $mail_smarty->assign("productid", $_productid); $mail_smarty->assign("email", $v["email"]); func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false); db_query("UPDATE $sql_tbl[email_for_changed_products] SET price='$product[price]' WHERE productid='$_productid' AND email='$v[email]'"); } } } # /Check email for changed product # END: SHISHAPIPE UK MOD - theshisha.com func_array2update("pricing", array("price" => $product['price']), "priceid = '$priceid'");
__________________
Apache/2.0.55 (Red Hat) & MYSQL Server: 5.0.24
PERL: 5.008005 / PHP: 4.4.4 - 4.3.1 X-CART

Shop carts at
http://www.nightscene.co.uk/shop/home.php
http://www.theshisha.net/shopcart/home.php
http://www.system-maintenance.com/maint/home.php
http://www.tabac4u.com
Reply With Quote