Jump to content

Adding Product name in subject of Out of stock mail alert


petiteetoilee

Recommended Posts

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 by petiteetoilee (see edit history)
Link to comment
Share on other sites

  • 3 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...