Magento2: 2.3.4 Email Template New Pickup Order or add New Template order items are missing in Mail

Created on 14 Feb 2020  路  33Comments  路  Source: magento/magento2

Preconditions (*)
magento 2.3.4

I installed magento 2.3.4 with sample data.
In the customer order mail order items are missing

Steps to reproduce(*)

Stores> Configuration> Sales > Sales Emails> New Order Confirmation select Template: New Pickup Order
Sales > Order: Select a order, goto Information, Send Mail

In the mail that Magento sends, the section with the order items is not transferred.
The same applies if you create a new template and select a template New Order or New Order (Magento Luma).

Only if you select
Stores> Configuration> Sales Emails> New Order Confirmation Template: New Order (default)
the order items will be transferred

Actual result (*)
In the customer order mail order items are missing

Expected result (*)
In the customer order mail order items should be there

Email Sales Fixed in 2.4.x Confirmed Format is valid Ready for Work Reported on 2.3.4 Reproduced on 2.4.x good first issue

Most helpful comment

In case it helps anyone.
If you're using a custom template for your order emails, I found that a temporary fix until the issue is solved by Magento is to update is_legacy to 1 in the email_template table for your order templates. This way Magento should correctly process {{layout handle="sales_email_order_items" order=$order area="frontend"}}. If is_legacy is 0 (this is the default value for a newly added template created after the upgrade), then the order passed to the blocks created by the sales_email_order_items handle is null, so no data will be displayed in the email.
Curious enough, if you're using the default template and not one saved in the DB, the order object is correctly passed into the order items grid blocks.

All 33 comments

Hi @stradd. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@stradd do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Hi @shikhamis11. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


:white_check_mark: Confirmed by @shikhamis11
Thank you for verifying the issue. Based on the provided information internal tickets MC-31544 were created

Issue Available: @shikhamis11, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @ramesh-durairajaram. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


Hi @shikhamis11 , I don't get this new pickup template in new order confirmation option. How do we get this new pickup template

I believe this issue also affects 2.3.3-p1 as well.

@magento give me 2.4-develop instance

Hi @verheesj. Thank you for your request. I'm working on Magento 2.4-develop instance for you

Hi @verheesj, here is your Magento instance.
Admin access: https://i-26882-2-4-develop.instances.magento-community.engineering/admin_8d71
Login: 9254450c Password: 9cc5942a15ef
Instance will be terminated in up to 3 hours.

How can this be solved? All my order emails are empty. Anyone has a fix? Thanks

@magento give me 2.4-develop instance

I can confirm. It seems every 2.3.4 are missing order_items_grid in emails, if they are not using default.

In case it helps anyone.
If you're using a custom template for your order emails, I found that a temporary fix until the issue is solved by Magento is to update is_legacy to 1 in the email_template table for your order templates. This way Magento should correctly process {{layout handle="sales_email_order_items" order=$order area="frontend"}}. If is_legacy is 0 (this is the default value for a newly added template created after the upgrade), then the order passed to the blocks created by the sales_email_order_items handle is null, so no data will be displayed in the email.
Curious enough, if you're using the default template and not one saved in the DB, the order object is correctly passed into the order items grid blocks.

I have also had a problem with this. Even if you make no changes, just creating an email template in the admin by loading and saving the default template, then assigning it, causes the items grid to be lost.

We have tested and confirmed this issue exists on both 2.3.3-p1 and 2.3.4

Hi @BrentRobert. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


Note, this also affects invoice ($order is null, $invoice is null), shipment ($order is null, $shipment is null) and credit memo ($order is null, $creditmemo is null) emails aswell as the $order ($order is null).

Hi @stradd, @BrentRobert.

Thank you for your report and collaboration!

The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.4-develop branch(es).
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@hryvinskyi Thanks for the patch, but it seems to be failing in a few places to apply on 2.3.4. I am getting this in response

error: patch failed: vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php:17
error: vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php: patch does not apply
error: app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/invoice_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/invoice_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/order_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/order_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/shipment_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/shipment_new_guest.html: No such file or directory

Most are just template location, as they should be on the vendor folder and easy to update, but I'm not sure about the Model classes.

@hryvinskyi Thanks for the patch, but it seems to be failing in a few places to apply on 2.3.4. I am getting this in response

error: patch failed: vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php:17
error: vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php: patch does not apply
error: app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/invoice_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/invoice_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/order_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/order_new_guest.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/shipment_new.html: No such file or directory
error: app/design/frontend/Magento/luma/Magento_Sales/email/shipment_new_guest.html: No such file or directory

Most are just template location, as they should be on the vendor folder and easy to update, but I'm not sure about the Model classes.

I actually adapted it for my ShipmentSender class, but it still doesn't fix the issue for me.
This was my change anyway

diff --git a/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php b/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php
index 4dbc103..090c6aa 100644
--- a/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php
+++ b/vendor/magento/module-sales/Model/Order/Email/Sender/ShipmentSender.php
@@ -108,7 +108,9 @@ class ShipmentSender extends Sender

             $transport = [
                 'order' => $order,
+                'order_id' => $$order->getId(),
                 'shipment' => $shipment,
+                'shipment_id' => $shipment->getId(),
                 'comment' => $shipment->getCustomerNoteNotify() ? $shipment->getCustomerNote() : '',
                 'billing' => $order->getBillingAddress(),
                 'payment_html' => $this->getPaymentHtml($order),

In case it helps anyone.
If you're using a custom template for your order emails, I found that a temporary fix until the issue is solved by Magento is to update is_legacy to 1 in the email_template table for your order templates. This way Magento should correctly process {{layout handle="sales_email_order_items" order=$order area="frontend"}}. If is_legacy is 0 (this is the default value for a newly added template created after the upgrade), then the order passed to the blocks created by the sales_email_order_items handle is null, so no data will be displayed in the email.
Curious enough, if you're using the default template and not one saved in the DB, the order object is correctly passed into the order items grid blocks.

This worked on magento 2.3.5 with the default magento email templates for anyone else waiting on 2.4 release

Hello There
I have the same isseu with the magento 2.3.4.
Can someone please give me instructions how I can update is_legacy to 1 in the email_template table?

Thanks for your support.
Best Wishes
Josko

Hello There
I have the same isseu with the magento 2.3.4.
Can someone please give me instructions how I can update is_legacy to 1 in the email_template table?

Thanks for your support.
Best Wishes
Josko

First you need to connect to the database. Use either phpMyAdmin or other SQL workbench.
Then you need to edit the column called is_legacy in the table email_template. Change the value from 0 to 1 for the templates, you are experimenting problems with.
If there are no rows in this table, you need to create new template from Magento backend first.

Hello There
I have the same isseu with the magento 2.3.4.
Can someone please give me instructions how I can update is_legacy to 1 in the email_template table?
Thanks for your support.
Best Wishes
Josko

First you need to connect to the database. Use either phpMyAdmin or other SQL workbench.
Then you need to edit the column called is_legacy in the table email_template. Change the value from 0 to 1 for the templates, you are experimenting problems with.
If there are no rows in this table, you need to create new template from Magento backend first.

Thank you! It works!

This bug is ridiculous and a huge waste of time. Even IDENTICAL templates to the magento "XXX (default)" don't show the product list... only direct database manipulation of "is_legacy" works. Come on now... This don't make any sense.

Changing "is_legacy" doesn't work for me on 2.3.5-p2. Does anyone know of a patch to get this working as I'm not in a position to upgrade to 2.4 yet?

@chrisastley have you seen this https://github.com/magento/magento2/pull/28331. Some guy made a backport to 2.3 for those fixes. Looks like magento never rolled in his commit because his PR was on the wrong branch 馃檮

@chrisastley have you seen this #28331. Some guy made a backport to 2.3 for those fixes. Looks like magento never rolled in his commit because his PR was on the wrong branch 馃檮

I had to modify the patch file in the end, it appears that the changes in magento 2.3.5-p2 included the changes to the luma theme email template files so I had to remove those from the patch and it then worked.

Ok I will post this here for others on 2.3 struggling with this. I rolled these fixes against 2.3.5-p2 (removing the template changes bc they are already there).

https://gist.github.com/jordanvector/ead76e777afb3fe71b4e7716496619a6#file-mc-31544-2-3-5-p2-patch

Then I can add it as a composer patch like so

            "magento/module-sales": {
                "MC-31544: Email Template New Pickup Order or add New Template order items are missing in Mail #28331": "patches/composer/MC-31544-2.3.5-p2.patch"
            }

The is_legacy set to 1 work around and patch from @jordanvector doesn't seem to fix the issue with the shipment (and tracking) email. Any ideas how to fix these?

PHP Fatal error:  Uncaught Error: Call to a member function getUrl() on null in ./vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml:28

In case it helps anyone.
If you're using a custom template for your order emails, I found that a temporary fix until the issue is solved by Magento is to update is_legacy to 1 in the email_template table for your order templates. This way Magento should correctly process {{layout handle="sales_email_order_items" order=$order area="frontend"}}. If is_legacy is 0 (this is the default value for a newly added template created after the upgrade), then the order passed to the blocks created by the sales_email_order_items handle is null, so no data will be displayed in the email.
Curious enough, if you're using the default template and not one saved in the DB, the order object is correctly passed into the order items grid blocks.

This worked on Magento 2.3.5 with the default Magento email templates. The perfect fix for the issue.

Was this page helpful?
0 / 5 - 0 ratings