Public function getTrackingInfoByTrackId($trackId) * Retrieve tracking by tracking entity id Īfter that you need create this block _trackFactory = $trackFactory You can copy vendor/magento/module-sales/view/frontend/email/shipment_new.html to your theme and edit line 56 (here you can change block for which display track information), you can change it like this. $info->setShipId($this->getShipment()->getEntityId()) įrom there, you should be able to call $block->getTrackingInfo() from the. $info = $this->shippingInfoFactory->create() Please note, this example is not tested: shippingInfoFactory = $shippingInfoFactory My answer assumes familiarity with Magento 2 theming - please feel free to ask questions about the other steps.Ī more "correct" way to implement this might be to use a di.xml preference for the template's block class. The only questionable thing here is the direct use of the Object Manager. GetUrl() ?>" target="_blank">getTracking() ?> Necessary for the $_info model to be able to get tracking info I referenced the shipment tracking "popup" template (which already has the tracking URL functionality) to implement tracking URL's in Magento_Sales/templates/email/shipment/track.phtml: create('Magento\Shipping\Model\Info') Magento_Sales/email/shipment_new_guest.html.This block is referenced in 2 email templates: Magento_Sales/templates/email/shipment/track.phtml.I recently had to implement tracking URL's in the shipment emails as well.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |