chetwyn Posted September 16, 2012 Share Posted September 16, 2012 Can't seem to get the mail alerts module to execute when a quantity is updated. All the quanties re updating correctly when I view the product through the BO but it just never fires off the mail alerts hook so none of the customers will get emails when the product is back in stock. Please help.. I'm stuck... please discard the product Id i have hard coded it's just for testing. This is my script: <?php $row = 0; $update_table = "ps_product_attribute"; $fileName = "update.csv"; // Load gloabl libs $site_base_path = "../"; include($site_base_path . 'config/config.inc.php'); require_once($site_base_path . 'classes/Link.php'); require_once($site_base_path . 'classes/Product.php'); require_once($site_base_path . 'classes/Module.php'); require_once($site_base_path . 'init.php'); $handle = fopen($fileName, "r"); while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) { $num = count($data); echo "\n"; echo "( $row )\n"; $row++; for ($c=0; $c < $num; $c++) { if ($c = 1) { $reference = $data[($c - 1)]; echo $reference . " - Reference Assigned\n"; } if ($c = 2) { $quantity = $data[($c - 1)]; echo "</br> "."UPDATE ".$update_table." SET quantity=".$quantity." WHERE reference='".$reference."'"."</br> "; Db::getInstance()->Execute("UPDATE ".$update_table." SET quantity=".$quantity." WHERE reference='".$reference."'"); echo $quantity . " - Quantity updated\n"; } /* if ($c = 3) { $price = $data[($c - 1)]; Db::getInstance()->Execute(("UPDATE $update_table SET price='$price' WHERE reference='$reference'") or die(mysql_error()); echo $price . " - Price updated\n"; } if ($c = 4) { $active = $data[($c - 1)]; mysql_query("UPDATE $update_table SET active='$active' WHERE reference='$reference'") or die(mysql_error()); echo $active . " - Activity updated\n"; echo "_____________________________________________________\n"; } */ } } fclose($handle); $sqlRecs = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("select id_product, sum(quantity) as qty from ps_product_attribute where id_product = 11554 group by id_product"); foreach($sqlRecs as $rec){ //Db::getInstance()->Execute("update ps_product set quantity = ".$rec['qty'].' where id_product = '.$rec['id_product']); echo "\n</br> Updated ID: ".$rec['id_product']."\n"; $args['product_id'] = $rec['id_product']; $args['quantity'] = $rec['qty']; Module::hookExec('updateQuantity', $args); } echo " \n"; echo " - - - SUCESSFULY COMPLETED - - - "; ?> Link to comment Share on other sites More sharing options...
rseigel Posted September 21, 2012 Share Posted September 21, 2012 Did you ever get this figured out. I have the exact same issue. Link to comment Share on other sites More sharing options...
benjamin utterback Posted September 21, 2012 Share Posted September 21, 2012 Hello chetwyn and Ron, thank you for the message. If you could, please provide the Version of PrestaShop you are running. Also, if you believe this to be a bug, you can post it on our Bug Tracker Forge here . We are working very hard everyday to continuously make PrestaShop better. Thank you for choosing PrestaShop! Regards, Benjamin Link to comment Share on other sites More sharing options...
rseigel Posted September 21, 2012 Share Posted September 21, 2012 PrestaShop™ 1.4.8.2 for me. Holding off on 1.5 for now. I don't know if this is so much to do with Preta as much as it is about not kn owing how to fire the code that checks this from a stand-alone script. See my other post in Development for more details on my side of it. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts