Radu Posted November 18, 2012 Share Posted November 18, 2012 Scenario: - creating modules in which we need to modify the prestashop core email templates till now when I wanted to override a mail template I just overwrote the file and I wanted to see other people aproaches. 1. simply overwrite the file for instance order_conf.html|txt when an order is placed 2. try and override the method that sends the email, in the presented example validateOrder from PaymentModule thank you! Link to comment Share on other sites More sharing options...
Radu Posted November 19, 2012 Author Share Posted November 19, 2012 I add also #3 possibility to override the MailCore class and inject the desired template data, change the template etc... depending of the $template parameter in your module folder create override/classes/Mail.php class Mail extends MailCore { /** * override send class so we can customize email templates */ function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null) { switch ($template) { case 'order_conf': $template_path = realpath(dirname(__FILE__).'/../../mails/'); break; } parent::Send($id_lang, $template, $subject, $template_vars, $to, $to_name, $from, $from_name, $file_attachment, $mode_smtp, $template_path, $die, $id_shop); } } in this way the email template will be taken from modules/your_module/mails/en/order_conf.html (for english language) Link to comment Share on other sites More sharing options...
Recommended Posts