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

Comments

Projects
None yet
@hostep
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2016

Issue got introduced in 44791d5

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

Pinging @naydav

@hostep

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2016

PR created: #5116

@wert2all wert2all self-assigned this Jun 23, 2016

@wert2all wert2all added the bug report label Jun 23, 2016

@wert2all wert2all removed their assignment Jun 23, 2016

@NadiyaS

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2016

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

@Tjitse-E

This comment has been minimized.

Copy link

commented Jul 14, 2016

This is still a bug in Magento 2.1.

@jernejh

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Jul 20, 2016

same issue 2.1 / php7/ nginx

@sumihiro

This comment has been minimized.

Copy link

commented Jul 26, 2016

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

@ahofstetter

This comment has been minimized.

Copy link

commented Aug 2, 2016

Same issue. Thanks @hostep

@sjovanig

This comment has been minimized.

Copy link

commented Aug 16, 2016

Magento 2.1.0 and same issue.

@NadiyaS

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2016

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

@sjovanig

This comment has been minimized.

Copy link

commented Aug 17, 2016

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

@sskharate

This comment has been minimized.

Copy link

commented Aug 19, 2016

Thanks it worked. saved valuable time 👍

@rbostan

This comment has been minimized.

Copy link

commented Oct 15, 2016

Problem continue with Magento 2.1.2
Fyi

@SerhiyShkolyarenko

This comment has been minimized.

Copy link
Contributor

commented Oct 18, 2016

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

@Ctucker9233

This comment has been minimized.

Copy link

commented Oct 21, 2016

@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

This comment has been minimized.

Copy link

commented Oct 25, 2016

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

@hezide

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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?

@jupiter01

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Nov 17, 2016

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Dec 2, 2016

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

@Rich8881

This comment has been minimized.

Copy link

commented Aug 16, 2017

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
You can’t perform that action at this time.