Jump to content

Adding fields to email templates


tss68nl

Recommended Posts

I am seriously lost in the email templates of version 1.6.1.7 of PrestaShop. What I want to do is, to create different overviews of an order and it's products that are sent as a 'Quote' / 'Pro forma invoice' / 'Confirmation' etc.

 

To do that, I have taken a look at the order_conf template, as it roughly displays the information I want to display for the confirmation. However, if I copy the template code to another email template to backoffice_order for example, most of the fields will display as {orders} and {delivery_block_html}.

 

This is probably due to the params not being filled out before the template is run. But, I cannot find where these fields are loaded? I've searched the net and these forums, and tried close to everything I could find, to no avail.

 

  • I started with the AdminOrdersController.php, as I expect when the status changes, the mail is sent: 
    There are a couple of mail send initiates here, but I cannot find any handler for the backoffice_order template?
  • I found mailalerts.php, which obviously handles mails, but I get the impression they are only the kinds that have a custom message from the database...
  • So I've taken a look at the PaymentModule.php which a lot of sources indicate this functionality would be in and around line 705 there are a lot of variables filled in. But, these already include the  {delivery_block_html} one for example, so this cannot be it.

So, I am properly lost.

  • Why doesn't the AdminOrdersController calculate the same fields as params for each and every template? It's a view on the same order, so in essence the data delivered to a template should not be restricted?
  • And why does the functionality seem so scattered in code? A mail handler applying a template for an order...is a mail handler applying a template to an order....in whichever form the template would be right? 

I am probably missing out on something here. Can someone shed a light on this? I would be interested in understanding the architecture/logic behind the functionality as well, as it makes more sense for future issues.

 

Thanks in advance for your time and help!

 

 

Link to comment
Share on other sites

  • 2 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...