Jump to content

send email to customers about voucher


unnati

Recommended Posts

prestashop hasn't got this feature

to sent an email to customer when the voucher code is created is necessary to edit the admin cart rules controller for example in afterAdd() funciton

 

at the end you can add function to send and email (with mail::send() function) to customer defined in $currentObject->customer variable

 

 

controllers/front/admin/adminCartRulesController.php

  • Like 1
Link to comment
Share on other sites

Thank you vekia for your help,

 

I've tried some coding, but since I'm worthless in programming, it doesn't work. :/

So, in "controllers/admin/adminCartRulesController.php file", in the "afterAdd()" function, I put this code :

 

$vars = array(
                        '{lastname}' => $customer->lastname,
                        '{firstname}' => $customer->firstname,
                        '{name}' => $cart_rule->name,
                        '{code}' => $cart_rule->code

                       );

 Mail::Send((int)$order->id_lang, 'discount', Mail::l('Your order discount', $order->id_lang),
                            $vars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null,
                            null, _PS_MAIL_DIR_, true, (int)$order->id_shop);  

 

I created 2 files named "discount.html" and "discount.txt" in the "mails" directory.

 

But according to the error message, "the $to variable is corrupted". I don't know what it means... :(

 

I just want to create an e-mail including the name, the value and the code of the voucher... 

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...