Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1.0-rc3] Loading certain email templates in backend doesn't work #5101

Closed
hostep opened this issue Jun 20, 2016 · 23 comments
Closed

[2.1.0-rc3] Loading certain email templates in backend doesn't work #5101

hostep opened this issue Jun 20, 2016 · 23 comments
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@hostep
Copy link
Contributor

hostep commented Jun 20, 2016

Steps to reproduce

  1. Install Magento 2.1.0-rc3 using composer
  2. In the backend, go to Marketing => Email Templates
  3. Click the 'Add a new Template' button
  4. Choose 'New Order' as Template and click the 'Load Template' button

Expected result

  1. The template is loaded without errors

Actual result

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

@hostep
Copy link
Contributor Author

hostep commented Jun 20, 2016

Issue got introduced in 44791d5

Looks like the same templates in the luma theme also got broken.

Pinging @naydav

@hostep
Copy link
Contributor Author

hostep commented Jun 20, 2016

PR created: #5116

@wert2all wert2all self-assigned this Jun 23, 2016
@wert2all wert2all removed their assignment Jun 23, 2016
@NadiyaS
Copy link
Contributor

NadiyaS commented Jun 27, 2016

Hi @hostep ,
thank you for your report and your PR. Internal ticket MAGETWO-54786 was created to process it.

@NadiyaS NadiyaS added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jun 27, 2016
@NadiyaS NadiyaS self-assigned this Jun 27, 2016
@Tjitse-E
Copy link
Contributor

This is still a bug in Magento 2.1.

@jernejh
Copy link

jernejh commented Jul 19, 2016

Facing the same problem with Magento 2.1 when trying to load New Order template in backend for translation purposes.

@liquidia
Copy link

liquidia commented Jul 20, 2016

same issue 2.1 / php7/ nginx

@sumihiro
Copy link

Facing the same problem with Magento 2.1.
And solved @hostep's PR. thx.

@ahofstetter
Copy link

Same issue. Thanks @hostep

@sergiojovanig
Copy link

Magento 2.1.0 and same issue.

@NadiyaS
Copy link
Contributor

NadiyaS commented Aug 16, 2016

Hi ,
fix 02bc3fc was delivered to develop branch. See #5116

@sergiojovanig
Copy link

Thanks @NadiyaS , I applied patch and it works as expected.

@sskharate
Copy link

Thanks it worked. saved valuable time 👍

@cizgidekiadam
Copy link

Problem continue with Magento 2.1.2
Fyi

@SerhiyShkolyarenko
Copy link
Contributor

@rbostan the fix was not included to 2.1.2 release. Now you may find it in develop branch only.

@Ctucker9233
Copy link

@SerhiyShkolyarenko So how hard would this have been to include in 2.1.2? It's just adding a comma to four files. I'm trying to understand the methodology here. I understand needing a cutoff point, at some point you have to ship what you have. But a lot of these fixes are no brainers and it's hard to understand why many things that had fixes prior to 2.1.2 were not included.

@Cacasapo
Copy link

From what I gather, 2.1.2 was only a security update, so no fixes were included.

@hezide
Copy link

hezide commented Nov 5, 2016

@olysenko this is not the same issue...
this issue is solved by adding the ',' but my issue is because of the %account_url.
Besides in this issue its only an error on preview and in my issue I can't save the template...

@bpoiss
Copy link

bpoiss commented Nov 7, 2016

The issue still exists. Can someone explain how it can take more than 5 months to add a comma to four files?

@ghost
Copy link

ghost commented Nov 12, 2016

I ran into this also, rather frustrating that it was fixed, but not introduced, could have saved me time trying to figure out what I assumed was something I did wrong. Would like to know why there are several fixes out there that dont make it into the mainline.

@mithname20
Copy link

Hi in my site when i load new order email template it shows error and Error message appears: The template did not load. Please review the log for details

I updated the line "var order.getShippingDescription()":"Shipping Description", with a comma "," at the end of line as suggested in some support pages to resolve the template load issue. Now i can load new order email template but the measure problem is that when i click to preview template or save template it goes a 404 page and nothing happen.

Some support page are saying to Install Magento 2.1.0-rc3 using composer.

What stand for Magento 2.1.0-rc3 and where i can get it download and install or there is any other option to resolve this issue . i want to keep the megento 2.1.0 version for my website.

Please reply with the correct solution .

@NadiyaS
Copy link
Contributor

NadiyaS commented Nov 17, 2016

Hi @mithname20,
if you encountered a new problem please, create additional issue according to Issue reporting guidelines.
Thanks

@NadiyaS NadiyaS removed their assignment Nov 17, 2016
@maderlock
Copy link

This was fixed in June. When are we going to see a fix?!

@Rich8881
Copy link

Hi Guys, the fix for this is scarily simple

In the file /public_html/vendor/magento/module-sales/view/frontend/email/order_new.html
on line ...about 16ish find this code

"var order.getShippingDescription()":"Shipping Description" and simply add a comma after it , like below

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

Like magic the template will load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests