mobo247 Posted December 23, 2014 Share Posted December 23, 2014 Hi dev forum, I am a new developer to php and prestashop and I am using prestashop v1.6. I want to create my own custom email to send to the customer and the merchant owner. I am having some trouble locating the module or php class or method that send the email (for example the Order confirmation email). I know in the admin console in Localization->Translations->Translations (under mailalerts new_order option) you can edit the HTML or text version of the email. It has special attributes like {shop_url}, {payment}, {order_name} and etc. I would like to add my own custom attribute {myownattr} to the list and be visible to the html and create my own custom email. I want to be able to add a vendor name, specific URL links, voucher code, voucher barcode, or custom generated QR code to the display on the email. How and where can I do that? Maybe some where in the send mail module (Mail.php)? Thank you in advance for any help! -Steve. Link to comment Share on other sites More sharing options...
bellini13 Posted December 23, 2014 Share Posted December 23, 2014 Hi Steve, It is the PaymentModule class that sends the order confirmation email to the customer. It has a function named validateOrder that executes this. You can edit the PaymentModule class or create an override and add the additional email template attributes that you require. As for the new order notification that goes to the merchant, you would need to make similar changes to the mailalert module. 1 Link to comment Share on other sites More sharing options...
mobo247 Posted December 23, 2014 Author Share Posted December 23, 2014 Thanks Bellini13 for you quick response! I found it in the mailalerts.php in the function hookActionValidateOrder($params). I hope by adding my custom attributes here in the $template_vars array, they will be visible to the html replacement variables. Many thanks. Hope this topic will help other prestashop newbies too. -Steve. mailalerts.php: ----------------------- public function hookActionValidateOrder($params) { ...... // Filling-in vars for email $template_vars = array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, Link to comment Share on other sites More sharing options...
mobo247 Posted December 24, 2014 Author Share Posted December 24, 2014 It didn't work. I added my custom attribute in the the $template_vars array in mailalerts.php but it didn't work. The html email sent couldn't find the my custom attribute to print 'hellothere'. What am I missing here? Again this is the "Order Confirmation" email to the customer. Any hint will will be great. -Steve. mailalerts.php: ------------------- $template_vars = array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{customattr}' => 'hellothere', ....... ~/www/themes/default-bootstrap/mails/en/order_conf.html --------------------------------------------------------------------------------------------------- <td> <span> {customattr}</span></td> Link to comment Share on other sites More sharing options...
bellini13 Posted December 24, 2014 Share Posted December 24, 2014 you added the attribute to the wrong template file. order_conf.html is not used by mailalerts, it is used by PaymentModule to send the email to the customer For the notification email that goes to the merchant, look in the mailalerts module folder for the correct mail template to use. 1 Link to comment Share on other sites More sharing options...
mobo247 Posted December 27, 2014 Author Share Posted December 27, 2014 Belini13, yes are right. It is in PaymentModule. I got my finding resolved. Thank you very much for the hint!!! Link to comment Share on other sites More sharing options...
Tahsin_85 Posted March 13, 2017 Share Posted March 13, 2017 (edited) Thanks Edited March 13, 2017 by Tahsin_85 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted March 13, 2017 Share Posted March 13, 2017 You can manipulate existing templates in /mails/en/order_conf.html you should try reading the thread posts before you reply. this is not what they are looking for... 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