Tuesday, 19 November 2019

Magento2 cannot load some transaction emails

error : main.CRITICAL: Zend_Json_Exception: Decoding failed: Syntax error in /home/forge/domain.com/vendor/magento/zendframework1/library/Zend/Json.php:97

This is a bug in Magento 2 and here is the solution:
This will fixed the invalid json objects in the order email templates.

See this on vendor/magento/module-sales/view/frontend/email/order_new.html file.

<!--@vars { "var formattedBillingAddress|raw":"Billing Address", "var order.getEmailCustomerNote()":"Email Order Note", "var order.increment_id":"Order Id", "layout handle=\"sales_email_order_items\" order=$order area=\"frontend\"":"Order Items Grid", "var payment_html|raw":"Payment Details", "var formattedShippingAddress|raw":"Shipping Address", "var order.getShippingDescription()":"Shipping Description" "var shipping_msg":"Shipping message" } @-->

Take a look at this line:

"var order.getShippingDescription()":"Shipping Description"

It needs comma (,) at the end of this line to make it work. So it goes with the other files or template files.

So it should be like this:

<!--@vars { "var formattedBillingAddress|raw":"Billing Address", "var order.getEmailCustomerNote()":"Email Order Note", "var order.increment_id":"Order Id", "layout handle=\"sales_email_order_items\" order=$order area=\"frontend\"":"Order Items Grid", "var payment_html|raw":"Payment Details", "var formattedShippingAddress|raw":"Shipping Address", "var order.getShippingDescription()":"Shipping Description", "var shipping_msg":"Shipping message" } @-->

No comments:

Post a Comment