Hi @AndyJAllen. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
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.3-develop instance
- upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@AndyJAllen do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
This is what the page source looks like:
I worked around this problem by just replacing \vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml with the 2.3.2 version.
It had to do with this code:
<a href="<?= $block->escapeUrl($block->getTrackingUrl()->getUrl($_item)) ?>" target="_blank">
<?= $block->escapeHtml($_item->getNumber()) ?>
</a>
Which the older version just has:
<?= $block->escapeHtml($_item->getNumber()) ?>
Hi @engcom-Charlie. 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:
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.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.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.
Hello @AndyJAllen
Thank you for contribution and collaboration!
We are not able to reproduce this issue on the lates 2.3-develop branch by provided steps.
Magento 2.3-develop has this code too:
Manual testing scenario:
Result:
Tracking information sent successfully and email received:
So i have to close this issue.
Thanks for your report!
I worked around this problem by just replacing \vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml with the 2.3.2 version.
It had to do with this code:
<a href="<?= $block->escapeUrl($block->getTrackingUrl()->getUrl($_item)) ?>" target="_blank"> <?= $block->escapeHtml($_item->getNumber()) ?> </a>
Which the older version just has:
<?= $block->escapeHtml($_item->getNumber()) ?>
I had the same problem after upgrading from 2.2.8 to 2.3.3. Your workaround worked for me. Thanks!
I worked around this problem by just replacing \vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml with the 2.3.2 version.
It had to do with this code:
<a href="<?= $block->escapeUrl($block->getTrackingUrl()->getUrl($_item)) ?>" target="_blank"> <?= $block->escapeHtml($_item->getNumber()) ?> </a>
Which the older version just has:
<?= $block->escapeHtml($_item->getNumber()) ?>
I had the same problem after upgrading from 2.2.8 to 2.3.3. Your workaround worked for me. Thanks!
I'm glad I was able to help someone. Good luck to you sir.
I have same issue when upgrade magento 2.3.2 to 2.3.3. Shipping created with Carrier: Custom value.
I wonder what we did different than what @engcom-Charlie did for different behavior? I copied all the framework, fedex, sales, and shipping modules from 2.3-develop and still had the issue. No custom modules that would have anything to do with the functionality.
@engcom-Charlie one thing I can tell you that is different in my scenario is I use smartpost which consists of two tracking numbers.
@AndyJAllen i tried again with smart post and two tracking numbers. Result is same:
Oh well; not going to grind my gears over it since I worked around it. Thanks for looking into it @engcom-Charlie
If I hit this again on 2.3.4 I'll dig deeper and report my findings.
@engcom-Charlie I am having the same issue with 2.3.3. I've done a search on the 2.3 repo, Magento 2.3 repo search and can't find any reference to where the method getTrackingUrl is created?
PHP Fatal error: Uncaught Error: Call to a member function getUrl() on null in /var/app/current/vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml:28\nStack trace:\n#0 /var/app/current/vendor/magento/framework/View/TemplateEngine/Php.php(59): include()\n#1 /var/app/current/vendor/magento/framework/View/Element/Template.php(271): Magento\\Framework\\View\\TemplateEngine\\Php->render(Object(Magento\\Framework\\View\\Element\\Template), '/var/app/curren...', Array)\n#2 /var/app/current/vendor/magento/framework/View/Element/Template.php(301): Magento\\Framework\\View\\Element\\Template->fetchView('/var/app/curren...')\n#3 /var/app/current/vendor/magento/framework/View/Element/AbstractBlock.php(1097): Magento\\Framework\\View\\Element\\Template->_toHtml()\n#4 /var/app/current/vendor/magento/framework/View/Element/AbstractBlock.php(1101): Magento\\Framework\\View\\Element\\AbstractBlock->Magento\\Framework\\View\\Element\\{closure}()\n#5 /var/app/current/vendor/magento/framework/View/Element/AbstractBlock.php(671): Magento\\Framework\\V in /var/app/current/vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml on line 28,
@AndyJAllen your work around did the trick.
Hello @aibean
You can find it in module-shipping/Helper/Data.php
I had the same issue after upgrading from Magento 2.3.2 to 2.3.3. The workaround of @AndyJAllen helped me too. Thanks for the tip!
Got the same problem. @AndyJAllen, thank you.
I also have exactly the same problem. Upgraded from 2.2.8 and shipment notification is broken. WIll have to maintain a patch against core for now with the workaround by @AndyJAllen. I really hope this will be re-opened. A lot of people are reporting that this is a problem for them.
EDIT: Can confirm that the workaround works for me.
We are having the exact same problem on 2.3.3. For us it is with UPS shipments. An interesting detail - the first shipment on any order does not have this issue. It is only for orders with split shipments, this will happen on any subsequent shipment made on an order that already has one. Both the weird screen popup, and no email.
@engcom-Charlie - Is it possible that nuance might mean something?
Hello @jove4015
I can't reproduce this issue with split UPS shipments on Magento 2.4-develop.
Testing scenario:
Ship all
Send tracking info for them
Result:
Emails:
For 1st:
2nd:
3rd
4th:
So no sense to re-open this issue.
Thank you for contribution and collaboration!
Can confirm I had the same issue after upgrading from 2.3.2 to 2.3.3 CE. Can confirm @AndyJAllen fix worked, but only after running bin/magento setup:static-content:deploy -f en_GB en_US i.e. Cache flush and restart Varnish was not enough.
This is probably caused by customized e-mail templates based on previous versions.
If you have customized e-mail templates inserting track.phtml this way:
{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='MyParcelNL_Magento::email/shipment/track.phtml' shipment=$shipment order=$order}}
Try changing that to this so it uses the layout XML:
{{layout handle="sales_email_order_shipment_track" shipment=$shipment order=$order}}
Otherwise track.phtml doesn't receive the (new) argument containing the TrackingUrl object argument defined in the layout xml.
These 2 commits together broke it:
https://github.com/magento/magento2/commit/32f0eb73748b00c919385f2bff57087192082921#diff-44dd6522f51e8d3946d9fc5cb2762d23
https://github.com/magento/magento2/commit/4e22c63169cbdb4650be2069e46b782e485b4940
@engcom-Charlie What's the policy on cases like this? It seems like a backward incompatibility issue that's missing from the release notes.
@arnoutvreugdenhil I saw that was the issue as well. Thanks for providing that layout XML. You saved me a lot of time. It was the solution to my issue, and you posted five hours right before! This was meant to be. Haha!
Hi @arnoutvreugdenhil,
Thanks for the correct point on resolving of the issue but looks like the some problems still there.
As we know order can have some shipments with relevant tracking information in each.
So, if you try send shipping info (for example from admin, using shipment button) Magento using trackCollection in track.phtml will sent all trackings, not from that one you have used.
Above fix by @arnoutvreugdenhil solved the problem for us as well.
Worth noting though, this only happened for orders where there was a custom value for the carrier. (Mentioning this because the tests to confirm the issue above specifically reference using named carriers.)
@aholovan wrote:
Thanks for the correct point on resolving of the issue but looks like the some problems still there.
As we know order can have some shipments with relevant tracking information in each.
So, if you try send shipping info (for example from admin, using shipment button) Magento using trackCollection in track.phtml will sent all trackings, not from that one you have used.
Andrii's exactly correct; on 2.3.3 (and security patch 2.3.3-p1), we noticed multi-shipment orders had every tracking number in consecutive shipment emails, EG:
Shipment 1, shipped by UPS, Tracking No: 1111111111, email shows the following:
Shipment 2: FedEx, Tracking No: 2222222222, but email shows both shipments incorrectly:
It should only show FedEx for the 2nd shipment email.
The reason is as Andrii pointed out, in in 2.3.3/2.3.3-p1, in:
\vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml, line 13:
<?php $trackCollection = $_order->getTracksCollection($_shipment->getId()) ?>
This line of code should be:
<?php $trackCollection = $_shipment->getTracksCollection() ?>
The reason being seems to be that the getTracksCollection function, at least on 2.3.3/2.3.3-p1, seems to have lost a constructor where it can be passed a shipment's id to filter the shipment data returned from the order's getTracksCollection. Since it has no constructor that uses the shipment id, it returns all shipments for the order, as we're seeing on 2.3.3/2.3.3-p1.
But, if you are on 2.3.3/2.3.3-p1 and are experiencing this issue, you can override track.phtml and make the change yourself to fix shipment emails until you can upgrade to a Magento verison where the track.phtml code is correct.
Note: We've noticed other shipment email issues still though for 2.3.3/2.3.3-p1, for example- the "shipped by" section isn't showing the full carrier name for us, and the product name is now showing (despite the variables in the template looking correct/being hydrated)... no idea why. :(
Gonna take a look at the changes to the track.phtml/items.phtml files in 2.3.4 / 2.4 pipelines, maybe I can figure it out. :/
facing same issue, trying to send USPS tracking information
I am also getting the same error on Magnto 2.3.4 using Porto 3.2.3 and the solution of @arnoutvreugdenhil did not resolve it. After I was unsuccessful modifying the porto shipment templates, I fell back to the luma templates for new shipment and new shipment guest which both have the following line and the error did not change:
{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}
In addition, I changed php max input variables to 10000
I am also getting the same error on Magnto 2.3.4 using Porto 3.2.3 and the solution of @arnoutvreugdenhil did not resolve it. After I was unsuccessful modifying the porto shipment templates, I fell back to the luma templates for new shipment and new shipment guest which both have the following line and the error did not change:
{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}In addition, I changed php max input variables to 10000
While working on another issue yesterday, I had to delete and re-deploy static content as well as clear all of my cache layers. My error has now resolved with the use of the Luma email templates instead of the Porto templates for New Shipment and New Shipment Guest. (Not sure if changing php max input variables had anything to do with it or not.)
I also faced the same issue for shipping email tracking number for Mangento 2.3.4 update. Unfortunatly AndyJAllen fix to the track.phtml didn't work for me . I think this because of my version is 2.3.4.
But when i change the "is_legacy = 1" for the specific template in the databse in the table "email_template" it worked.
Table : email_template
Sql : update email_template set is_legacy = 1;
There's an easy fix. The problem is caused by your previous modified email
template. You can change back to the default template on the
store->configuration->sales->sales emails page. Maybe you can delete the
modified email template on Marketing->Email Templates page first, and
modify the template again using the current default template. But right now
I am just using the default one. Problem solved.
On Thu, Jul 2, 2020 at 9:45 PM viduranishantha notifications@github.com
wrote:
I also faced the same issue for shipping email tracking number for
Mangento 2.3.4 update. Unfortunatly AndyJAllen fix to the track.phtml
didn't work for me . I thinks this because my version is 2.3.4.But when i change the "is_legacy = 1" for the specific template in the
databse in the table "email_template" it worked.
Table : email_template
Sql : update email_template set is_legacy = 1;—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/25221#issuecomment-653288593,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AELBPKFAJVB4OQIPWZZHBGLRZUZ5JANCNFSM4JDRDNJA
.
Hi
To fix the issue please replace following file with the magento2 version 2.3.5.
vendor/magento/module-sales/view/frontend/templates/email/shipment/track.phtml
Thanks
I worked around this problem by just replacing \vendor\magento\module-sales\view\frontend\templates\email\shipment\track.phtml with the 2.3.2 version.
It had to do with this code:
<a href="<?= $block->escapeUrl($block->getTrackingUrl()->getUrl($_item)) ?>" target="_blank"> <?= $block->escapeHtml($_item->getNumber()) ?> </a>
Which the older version just has:
<?= $block->escapeHtml($_item->getNumber()) ?>
I had the same problem after upgrading from 2.2.8 to 2.3.3. Your workaround worked for me. Thanks!
The problem returned after upgrading to 2.3.5-p2. Now we're getting logged out after adding the tracking number, but it is saved to the order. I checked the file and this fix is already present. Now I'm looking for a new solution.
Some error present after upgrade to 2.3.5-p2, resolved with AndyJAllen solution and make a static-rebuild
Thanks a lot to AndyJAllen !
same problem with 2.3.5-p2, resolved with AndyJAllen solution and making clear cache and static deploy
Thanks a lot to AndyJAllen !
This issue appears because old Magento version has shipment_new.html with {{block ... }} directive
But now it contaions {{layout ... }} directive.
Layout has "viewModel" tracking_url that block doesn't
<block class="Magento\Framework\View\Element\Template" name="sales.order.email.shipment.track" template="Magento_Sales::email/shipment/track.phtml">
<arguments>
<argument name="tracking_url" xsi:type="object">Magento\Sales\Block\DataProviders\Email\Shipment\TrackingUrl</argument>
</arguments>
</block>
So if you update shipment_new.html and store this email as transactional email (Marketing->Email Templates) in previous Magento version with {{block ...}} directive you get this error because block don't have "viewModel" tracking_url.
The easiest way is to update transaction email and replace {{block ... }} directive with {{layout ...}} directive.
Most helpful comment
This is probably caused by customized e-mail templates based on previous versions.
If you have customized e-mail templates inserting track.phtml this way:
{{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='MyParcelNL_Magento::email/shipment/track.phtml' shipment=$shipment order=$order}}
Try changing that to this so it uses the layout XML:
{{layout handle="sales_email_order_shipment_track" shipment=$shipment order=$order}}
Otherwise track.phtml doesn't receive the (new) argument containing the TrackingUrl object argument defined in the layout xml.
These 2 commits together broke it:
https://github.com/magento/magento2/commit/32f0eb73748b00c919385f2bff57087192082921#diff-44dd6522f51e8d3946d9fc5cb2762d23
https://github.com/magento/magento2/commit/4e22c63169cbdb4650be2069e46b782e485b4940
@engcom-Charlie What's the policy on cases like this? It seems like a backward incompatibility issue that's missing from the release notes.