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.3.3 - "Send Tracking Information" not working. #25221

Closed
AndyJAllen opened this issue Oct 22, 2019 · 48 comments
Closed

2.3.3 - "Send Tracking Information" not working. #25221

AndyJAllen opened this issue Oct 22, 2019 · 48 comments
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@AndyJAllen
Copy link

Preconditions (*)

  1. Magento 2.3.3, upgraded from 2.3.2
  2. Shipment created with Fedex packaging

Steps to reproduce (*)

  1. Click the Send Tracking Information button.
    image

Expected result (*)

  1. Tracking email is sent with confirmation notification

Actual result (*)

  1. Receive technical error notification, then a mostly blank page loads that looks like this:
    image
@m2-assistant
Copy link

m2-assistant bot commented Oct 22, 2019

Hi @AndyJAllen. 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.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?

  • yes
  • no

@AndyJAllen
Copy link
Author

This is what the page source looks like:
image

@AndyJAllen
Copy link
Author

AndyJAllen commented Oct 22, 2019

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()) ?>

@engcom-Charlie engcom-Charlie self-assigned this Oct 23, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 23, 2019

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: 👇

  • 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.3-develop branch

    Details- 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.

@engcom-Charlie
Copy link
Contributor

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:
image

Manual testing scenario:

  1. Place order with Fedex shipment
  2. Create a shipment for this order
  3. Send a Tracking Information

Result:
Tracking information sent successfully and email received:
image
image

So i have to close this issue.
Thanks for your report!

@timelam
Copy link

timelam commented Oct 23, 2019

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!

@AndyJAllen
Copy link
Author

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.

@Userr017
Copy link

I have same issue when upgrade magento 2.3.2 to 2.3.3. Shipping created with Carrier: Custom value.

@AndyJAllen
Copy link
Author

AndyJAllen commented Oct 24, 2019

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.

@engcom-Charlie
Copy link
Contributor

@AndyJAllen i tried again with smart post and two tracking numbers. Result is same:
image

@AndyJAllen
Copy link
Author

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.

@aibean
Copy link

aibean commented Oct 27, 2019

@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.

@engcom-Charlie
Copy link
Contributor

Hello @aibean
You can find it in module-shipping/Helper/Data.php
image

@marowi85
Copy link

marowi85 commented Nov 6, 2019

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!

@colyield
Copy link

Got the same problem. @AndyJAllen, thank you.

@crankycyclops
Copy link
Contributor

crankycyclops commented Nov 25, 2019

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.

@jove4015
Copy link

jove4015 commented Dec 5, 2019

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?

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Dec 6, 2019

Hello @jove4015
I can't reproduce this issue with split UPS shipments on Magento 2.4-develop.

Testing scenario:

  1. Place order with split shipping via UPS
    orderwithships from 2019-12-06 11-39-58
    thankyou

  2. Ship all
    image

  3. Send tracking info for them

  4. Check mails

Result:
Emails:
For 1st:
image
2nd:
image
3rd
image
4th:
image

So no sense to re-open this issue.
Thank you for contribution and collaboration!

@dharake
Copy link

dharake commented Dec 6, 2019

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.

@arnoutvreugdenhil
Copy link

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.

@anromeo
Copy link

anromeo commented Dec 18, 2019

@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!

@aholovan
Copy link
Contributor

aholovan commented Jan 27, 2020

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.

@infinityredux
Copy link

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.)

@not-art
Copy link

not-art commented Apr 2, 2020

@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:

  • UPS: 1111111111

Shipment 2: FedEx, Tracking No: 2222222222, but email shows both shipments incorrectly:

  • UPS: 1111111111
  • FedEx, 2222222222

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. :/

@sam110386
Copy link

facing same issue, trying to send USPS tracking information

@RN-Say
Copy link

RN-Say commented Apr 14, 2020

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

Blank Screen

Error Messages

@RN-Say
Copy link

RN-Say commented Apr 17, 2020

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.)

success

@viduranishantha
Copy link

viduranishantha commented Jul 3, 2020

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;

@colyield
Copy link

colyield commented Jul 3, 2020 via email

@pprignesh
Copy link

pprignesh commented Aug 18, 2020

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

@timelam
Copy link

timelam commented Aug 31, 2020

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.

@antonioste
Copy link

Some error present after upgrade to 2.3.5-p2, resolved with AndyJAllen solution and make a static-rebuild

Thanks a lot to AndyJAllen !

@dloca68
Copy link

dloca68 commented Dec 3, 2020

same problem with 2.3.5-p2, resolved with AndyJAllen solution and making clear cache and static deploy

Thanks a lot to AndyJAllen !

@ghost
Copy link

ghost commented Dec 10, 2020

This issue appears because old Magento version has shipment_new.html with {{block ... }} directive
Снимок экрана 2020-12-10 в 14 36 29

But now it contaions {{layout ... }} directive.
Снимок экрана 2020-12-10 в 14 37 53

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.
Снимок экрана 2020-12-10 в 14 45 39

The easiest way is to update transaction email and replace {{block ... }} directive with {{layout ...}} directive.
Снимок экрана 2020-12-10 в 14 47 52

@ravirajm10
Copy link

ravirajm10 commented Mar 12, 2021

Hi

This issue has been fixed in 2.4.1 .

They have modified
vendor/magento/module-sales/view/frontend/layout/sales_email_order_shipment_track.xml as

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="sales_email_order_shipment_renderers"/>
    <body>
        <block class="Magento\Sales\Block\Order\Email\Shipment\Items" 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>
    </body>
</page>

AND

vendor/magento/module-sales/Block/Order/Email/Shipment/Items.php as

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Sales\Block\Order\Email\Shipment;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Element\Template\Context;
use Magento\Sales\Api\Data\ShipmentInterface;
use Magento\Sales\Api\Data\OrderInterface;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Sales\Api\ShipmentRepositoryInterface;

/**
 * Sales Order Email Shipment items
 *
 * @api
 * @since 100.0.2
 */
class Items extends \Magento\Sales\Block\Items\AbstractItems
{
    /**
     * @var OrderRepositoryInterface
     */
    private $orderRepository;

    /**
     * @var ShipmentRepositoryInterface
     */
    private $shipmentRepository;

    /**
     * @param Context $context
     * @param array $data
     * @param OrderRepositoryInterface|null $orderRepository
     * @param ShipmentRepositoryInterface|null $creditmemoRepository
     */
    public function __construct(
        Context $context,
        array $data = [],
        ?OrderRepositoryInterface $orderRepository = null,
        ?ShipmentRepositoryInterface $creditmemoRepository = null
    ) {
        $this->orderRepository =
            $orderRepository ?: ObjectManager::getInstance()->get(OrderRepositoryInterface::class);
        $this->shipmentRepository =
            $creditmemoRepository ?: ObjectManager::getInstance()->get(ShipmentRepositoryInterface::class);

        parent::__construct($context, $data);
    }

    /**
     * Prepare item before output
     *
     * @param \Magento\Framework\View\Element\AbstractBlock $renderer
     * @return void
     */
    protected function _prepareItem(\Magento\Framework\View\Element\AbstractBlock $renderer)
    {
        $renderer->getItem()->setOrder($this->getOrder());
        $renderer->getItem()->setSource($this->getShipment());
    }

    /**
     * Returns order.
     *
     * Custom email templates are only allowed to use scalar values for variable data.
     * So order is loaded by order_id, that is passed to block from email template.
     * For legacy custom email templates it can pass as an object.
     *
     * @return OrderInterface|null
     * @since 102.1.0
     */
    public function getOrder()
    {
        $order = $this->getData('order');
        if ($order !== null) {
            return $order;
        }

        $orderId = (int)$this->getData('order_id');
        if ($orderId) {
            $order = $this->orderRepository->get($orderId);
            $this->setData('order', $order);
        }

        return $this->getData('order');
    }

    /**
     * Returns shipment.
     *
     * Custom email templates are only allowed to use scalar values for variable data.
     * So shipment is loaded by shipment_id, that is passed to block from email template.
     * For legacy custom email templates it can pass as an object.
     *
     * @return ShipmentInterface|null
     * @since 102.1.0
     */
    public function getShipment()
    {
        $shipment = $this->getData('shipment');
        if ($shipment !== null) {
            return $shipment;
        }

        $shipmentId = (int)$this->getData('shipment_id');
        if ($shipmentId) {
            $shipment = $this->shipmentRepository->get($shipmentId);
            $this->setData('shipment', $shipment);
        }

        return $this->getData('shipment');
    }
}

Below is the layout handle from shipping template
{{layout handle="sales_email_order_shipment_track" shipment_id=$shipment_id order_id=$order_id}}
OR In old Version You Can use
{{layout handle="sales_email_order_shipment_track" shipment_id=$shipment.entity_id order_id=$order.entity_id}}

NOTE: Just sharing fix from 2.4.1 version . Anyone working on old version can try with it.

@joemstar
Copy link

I am using Magento 2.4.2. My store was a fresh install of 2.4.1 and was upgraded to 2.4.2. I am using the Codazon Fastest theme and I am having the same problem, even with orders with a single shipment. I am having the problem with UPS specifically. It doesn't appear this has been fixed in 2.4.1 unless my theme is somehow causing the issue. Any help would be appreciated.
Thanks!

@enyceedanny
Copy link

I'm having the same issue on 2.4.2 as well.

@enyceedanny
Copy link

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.

Wow I've been going nuts for 2 days trying to figure this out. Your solution is what fixed it. Thank you!

@ravirajm10
Copy link

ravirajm10 commented Mar 27, 2021

I'm having the same issue on 2.4.2 as well.

Do check the email template basically below part

{{layout handle="sales_email_order_shipment_track" shipment=$shipment order=$order}}

Should be

{{layout handle="sales_email_order_shipment_track" shipment_id=$shipment.entity_id order_id=$order.entity_id}}

@ravirajm10
Copy link

ravirajm10 commented Mar 27, 2021

I am using Magento 2.4.2. My store was a fresh install of 2.4.1 and was upgraded to 2.4.2. I am using the Codazon Fastest theme and I am having the same problem, even with orders with a single shipment. I am having the problem with UPS specifically. It doesn't appear this has been fixed in 2.4.1 unless my theme is somehow causing the issue. Any help would be appreciated.
Thanks!

Do check email template basically below part

{{layout handle="sales_email_order_shipment_track" shipment=$shipment order=$order}}

Should be

{{layout handle="sales_email_order_shipment_track" shipment_id=$shipment.entity_id order_id=$order.entity_id}}

@enyceedanny
Copy link

That works for the emails. But I noticed that those emails that fail, when clicking on the tracking link on either admin or as logged in customer, it throws an exception as well.

Notice: Trying to access array offset on value of type bool in /vendor/magento/module-ups/Model/Carrier.php

@joemstar
Copy link

The solution provided by enyceedanny worked for me.

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}}

I am also using the codazon fastest theme with 2.4.2. I am going to report this to them so hopefully they update their code and I don't have to make this correction every time there's an update to the theme.

@stefanskotte
Copy link

This issue is exactly the same for the Porto 3.2.6 theme - I will report this to the developers.

@dharake
Copy link

dharake commented Aug 30, 2021

I just finished upgrading to 2.4.3. Guess what, issue still persists. Kind of an important functionality no?

Anyway, usual workaround applied, replaced track.phtml with old one, did the trick. Please note, my track.phtml is timestamped 3rd Feb 2020 LMFAO.

Hola Magento! Wakey wakey

@dharake
Copy link

dharake commented Aug 30, 2021

This issue is exactly the same for the Porto 3.2.6 theme - I will report this to the developers.

@stefanskotte I'm also using Porto. Seeing the file we have to replace here is in vendor/magento, this implies that the problem comes from Magento core, as the template is not being overwritten by Porto. Hope that helps.

@teodorpav
Copy link

In 2.4.3 the issue is still there.

@vincen2b
Copy link

vincen2b commented Nov 5, 2021

In 2.4.3 the issue is still there.

Looks like a possible fix MC-42758 was merged on August 10, the same date 2.4.3 was released.

The branch 2.4-develop is up-to-date with the fix, but not the 2.4.3 release branch.

I don't know much about Magento releases. Should we expect this fix to be released in a patch or in the next feature update?

@tuyennn
Copy link
Member

tuyennn commented Nov 30, 2021

Actually this issue was caused by your theme sales email htmls was located in

app/design/frontend/Foo/bar/Magento_Sales/email/*.html
Remove those or check whether they were upgraded, comparable with original ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests