Skip to content

Incomplete shipping carrier creates exception in shipping tracking pop-up #39549

Open
@andirosu

Description

Preconditions and environment

On Magento 2.4.7-p3, you can create a shipping carrier model that says it has tracking, but the getTrackingInfo() call is not enforced for implementation.

Steps to reproduce

  1. Create order as a customer with a shipping carrier that has isTrackingAvailable() = true , but doesn't have any declaration of getTrackingInfo (eg: https://commercemarketplace.adobe.com/sameday-magento2-plugin.html)
  2. Invoice and ship the order (use any random number as tracking code).
  3. Navigate as customer to the customer sales over view and open the "track this shipment" pop-up

Expected result

Pop-up opens with some tracking info.

Actual result

The pop-up opens with this message:
"An error has happened during application run. See exception log for details."

Additional information

In the exception log, the Call to undefined method Magento\\Framework\\Phrase::getTracking() message is added.
In the [details.phtml]
file (

$number = is_object($track) ? $track->getTracking() : $track['number'];
)

The template's block returns a Phrase object if the carrier doesn't have tracking info, causing the wrong call:

$trackingInfo = $carrierInstance->getTrackingInfo($this->getNumber()); if (!$trackingInfo) { return __('No detail for number "%1"', $this->getNumber()); }
This can be caused because the CarrierInterface doesn't force carriers to implement the getTrackingInfo method and therefore, carriers can be created with
public function isTrackingAvailable() { return true; }
but no getTrackingInfo function defined.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Assignees

Labels

Reported on 2.4.7-p3Indicates original Magento version for the Issue report.

Type

No type

Projects

  • Status

    Ready for Confirmation

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions