简体   繁体   中英

Third party modules in mailalert on prestashop

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!

You should override the PaymentModule class and add your custom variable to the email template.

Copy the validateOrder method from classes/PaymentModule.php

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM