Jump to content

How to sent email notification when customer subscribed to the out of stock product?


trace

Recommended Posts

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

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...