Closed
Description
Steps to reproduce
- Install Magento 2.1.0-rc3 using composer
- In the backend, go to Marketing => Email Templates
- Click the 'Add a new Template' button
- Choose 'New Order' as Template and click the 'Load Template' button
Expected result
- The template is loaded without errors
Actual result
- Error message appears:
The template did not load. Please review the log for details.
In the exception.log file, I see:
[2016-06-20 10:06:47] main.CRITICAL: Zend_Json_Exception: Decoding failed: Syntax error in vendor/magento/zendframework1/library/Zend/Json.php:97
Stack trace:
#0 vendor/magento/module-email/Model/Template.php(306): Zend_Json::decode('{"var formatted...')
#1 vendor/magento/module-email/Model/Template.php(320): Magento\Email\Model\Template->_parseVariablesString('{"var formatted...')
#2 vendor/magento/module-email/Controller/Adminhtml/Email/Template/DefaultTemplate.php(52): Magento\Email\Model\Template->getVariablesOptionArray(true)
#3 var/generation/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate/Interceptor.php(24): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate->execute()
#4 vendor/magento/framework/App/Action/Action.php(102): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor->execute()
#5 vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#6 vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#7 vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor->___callParent('dispatch', Array)
#8 vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Email\\C...', 'dispatch', Object(Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor), Array, 'adminAuthentica...')
#9 vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#10 vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#11 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Email\\C...', 'dispatch', Object(Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor), Array, 'adminMassaction...')
#12 vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#13 vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#14 var/generation/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate/Interceptor.php(39): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor->___callPlugins('dispatch', Array, Array)
#15 vendor/magento/framework/App/FrontController.php(55): Magento\Email\Controller\Adminhtml\Email\Template\DefaultTemplate\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#16 vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#17 vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#18 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#19 vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#20 vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#21 var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#22 vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#24 pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#25 {main} [] []
Discoveries
After searching a bit around, it looks like the json in the <!--@vars ... @-->
isn't valid in the file vendor/magento/module-sales/view/frontend/email/order_new.html
:
<!--@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"
} @-->
There is a trailing comma missing after "Shipping Description"
If I add a comma, the issue is fixed.
This issue also exists in the order_new_guest.html
file, I haven't took the time to check all other email templates, but maybe some other ones might have the same problem?