Jump to content

Custom order email shows variable as plain text. Presta 9


ptityop

Recommended Posts

Hello,

i needed to create a cutom order status that uses the same template order_conf but with seperate text. So i created the status and copied all the order_conf tpl files, gave them a different name, regenerated emails. The issue is that when I use this status, the email comes with variables showing up as plain text.

The only variables that return data are {shop_url} {firstname} {lastname} {total_paid} {shop_name}

What am i missing ?

Thanks in advance

Edited by ptityop (see edit history)
Link to comment
Share on other sites

Hello,

What you're experiencing is normal behaviour in PrestaShop.

Even if you duplicate the order_conf template and assign it to a custom order status, the full set of variables (like {products}, {delivery_block_html}, {invoice_block_html}, {carrier}, etc.) will not be available.

This happens because the complete order_conf variables are only generated inside PaymentModule::validateOrder(), which runs during payment validation (when the order is first created).

When you change an order status from the Back Office, PrestaShop sends the email through OrderHistory::changeIdOrderState(). That method only assigns a limited set of basic variables such as:
1) {shop_url}
2) {shop_name}
3) {firstname}
4) {lastname}
5) {total_paid}

It does not build the full product list, address blocks, discounts, and other order details.

If you need the same full order confirmation layout with different text triggered by a custom status, the proper solution is to create a small module that hooks into actionOrderStatusPostUpdate and manually builds the same variables before calling Mail::send().

Best Regards,
 

Link to comment
Share on other sites

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