trace Posted July 26, 2017 Share Posted July 26, 2017 (edited) How to do email notification after customer subscribed to the out of stock product? File: https://github.com/PrestaShop/mailalerts/blob/master/controllers/front/actions.php Why this code is not work? if ($mail_alert->add() !== false) { die('1'); $product_name = Product::getProductName($id_customer); $shop_email = '[email protected]'; $shop_name = Configuration::get('PS_SHOP_NAME'); $dir_mail = dirname(__FILE__).'/../../mails/'; $template_vars = array( '{customer_email}' => $customer_email, '{product_name}' => $product_name ); Mail::Send( $id_lang, 'new_oos', Mail::l('New request of product', $id_lang), $template_vars, (string)$shop_email, null, (string)$shop_email, (string)Configuration::get('PS_SHOP_NAME', null, null, $id_shop), null, null, $dir_mail, false, $id_shop ); } else { die('0'); } } P.S: Email templates (new_oos.html and new_oos.txt) added to the mailalerts/mails/en/ folder. Edited July 26, 2017 by trace (see edit history) Link to comment Share on other sites More sharing options...
trace Posted July 29, 2017 Author Share Posted July 29, 2017 Up. Please! Can anybody help? Link to comment Share on other sites More sharing options...
trace Posted August 6, 2017 Author Share Posted August 6, 2017 up Link to comment Share on other sites More sharing options...
DataKick Posted August 6, 2017 Share Posted August 6, 2017 (edited) you prematurely terminate the first if branch by die(1) - your code is equivalent to this if ($mail_alert->add() !== false) { die('1'); } else { die('0'); } Edited August 6, 2017 by DataKick (see edit history) 1 Link to comment Share on other sites More sharing options...
trace Posted August 6, 2017 Author Share Posted August 6, 2017 you prematurely terminate the first if branch by die(1). OMG... Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now