petiteetoilee Posted October 1, 2015 Share Posted October 1, 2015 (edited) Hello there ! I have a very simple question. When I receive an email alert "Product out of stock" (module emailalerts) I would like the name of this out of stock product to appear in my email subject like this : [shop_name] Product out of stock - {Name of the product} I think it has to be change there in mailalerts.php : $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); $template_vars = array( '{qty}' => $quantity, '{last_qty}' => $ma_last_qties, '{product}' => $product_name ); // Do not send mail if multiples product are created / imported. if (!defined('PS_MASS_PRODUCT_CREATION') && file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') && file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html')) { // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients $merchant_mails = explode(self::__MA_MAIL_DELIMITOR__, $this->merchant_mails); foreach ($merchant_mails as $merchant_mail) { Mail::Send( $id_lang, 'productoutofstock', Mail::l('Product out of stock', $id_lang), $template_vars, $merchant_mail, null, (string)$configuration['PS_SHOP_EMAIL'], (string)$configuration['PS_SHOP_NAME'], null, null, dirname(__FILE__).'/mails/', false, $id_shop ); } } } But I have to admit I'm not a great php coder so my few tries were a big fail. Could someone please help me with this? Thanks a lot ! Edited October 1, 2015 by petiteetoilee (see edit history) Link to comment Share on other sites More sharing options...
petiteetoilee Posted October 1, 2015 Author Share Posted October 1, 2015 It would be so easier to know directly what product is Out of stock. Up please ! Link to comment Share on other sites More sharing options...
yaniv14 Posted October 1, 2015 Share Posted October 1, 2015 Try to change this line: Mail::l('Product out of stock', $id_lang), To: sprintf(Mail::l('Product out of stock - %s', $id_lang), $product_name), Link to comment Share on other sites More sharing options...
petiteetoilee Posted October 2, 2015 Author Share Posted October 2, 2015 Try to change this line: Mail::l('Product out of stock', $id_lang), To: sprintf(Mail::l('Product out of stock - %s', $id_lang), $product_name), It's working perfectly, Thanks a lot ! Link to comment Share on other sites More sharing options...
staut82 Posted March 18, 2019 Share Posted March 18, 2019 On 10/1/2015 at 10:30 PM, yaniv14 said: Try to change this line: Mail::l('Product out of stock', $id_lang), To: sprintf(Mail::l('Product out of stock - %s', $id_lang), $product_name), Thanks ! 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