I am getting the error :
Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Phrase::getTracking() in /domains/XX/http/vendor/magento/module-shipping/view/frontend/templates/tracking/details.phtml:21 Stack trace: #0
On the customer "track order" (through the back end also) which is the popup.html in in module-shipping.
I have seen the magento github it was apperently fixed by 2.2 but i'm on 2.3.3 and i'm getting the issue.
Hi @gazsmith10. 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.4-develop instance - upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
@gazsmith10 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
The problem is in \Magento\ShippingModel\Order\Track::getNumberDetail. If a carrier instance can be loaded, the logic assumes it will have a getTrackingInfo method that will return a data object. When it doesn't, a phrase object is returned instead. A phrase object is fundamentally incompatible with Magento_Shipping::tracking/details.phtml.
When a carrier instance doesn't return tracking info, it should fall back to the same behavior it uses when there is no carrier instance: return an array containing the title and tracking number.
I recommend getNumberDetail be updated to this:
`
$carrierInstance = $this->_carrierFactory->create($this->getCarrierCode());
if ($carrierInstance) {
$carrierInstance->setStore($this->getStore());
$carrierInfo = $carrierInstance->getTrackingInfo($this->getNumber());
if ($carrierInfo) {
return $carrierInfo;
}
}
$trackingInfo = [];
$trackingInfo['title'] = $this->getTitle();
$trackingInfo['number'] = $this->getTrackNumber();
return $trackingInfo;
`
Most helpful comment
The problem is in \Magento\ShippingModel\Order\Track::getNumberDetail. If a carrier instance can be loaded, the logic assumes it will have a getTrackingInfo method that will return a data object. When it doesn't, a phrase object is returned instead. A phrase object is fundamentally incompatible with Magento_Shipping::tracking/details.phtml.
When a carrier instance doesn't return tracking info, it should fall back to the same behavior it uses when there is no carrier instance: return an array containing the title and tracking number.
I recommend getNumberDetail be updated to this:
`
$carrierInstance = $this->_carrierFactory->create($this->getCarrierCode());
if ($carrierInstance) {
$carrierInstance->setStore($this->getStore());
$carrierInfo = $carrierInstance->getTrackingInfo($this->getNumber());
if ($carrierInfo) {
return $carrierInfo;
}
}
`