I have a custom module that I'm using on prestashop 1.5.4.1 and I
need to show some information on the new_order email.
I'm quite new to prestashop and it's the first time I'm messing with
it.. I wanna know how I can get the variable of that module and show it
on the email template.
I already found where the new_order mail variables are set, but don't know how I can add my new custom variable to it.
Any help will be appreciated. Thanks!
I already found where the new_order mail variables are set, but don't know how I can add my new custom variable to it.
Any help will be appreciated. Thanks!
Answer:
You should override the PaymentModule class and add your custom variable to the email template.
Copy the
Create
Copy
Add your custom variable to the new
validateOrder method from classes/PaymentModule.phpCreate
override/classes/PaymentModule.php and paste the validateOrder method:<?php
class PaymentModule extends PaymentModuleCore
{
//paste validateOrder here
}
Find the following line in validateOrder:'{delivery_other}' => $delivery->other,
After that line assign your custom variable. For example:'{delivery_date}' => $myDeliveryDate,
Remove /cache/class_index.php to clear the cache.Copy
order_conf.html and order_conf.txt from mails/en to themes/YOURTHEME/mails/en if they are not already there. This will prevent PrestaShop updates to overwrite your changes.Add your custom variable to the new
order_conf.html and order_conf.txt. For example:<tr>
<td align="left">Delivery date: {delivery_date}</td>
</tr>
No comments:
Post a Comment