57 \
Magento\Sales\Model\OrderFactory $orderFactory,
63 $this->_shippingData = $shippingData;
64 $this->_orderFactory = $orderFactory;
66 $this->_trackFactory = $trackFactory;
67 $this->_trackCollectionFactory = $trackCollectionFactory;
68 parent::__construct(
$data);
84 $this->setProtectCode(
$data[
'hash']);
86 if ($this->getOrderId() > 0) {
88 }
elseif ($this->getShipId() > 0) {
91 $this->getTrackingInfoByTrackId();
112 protected function _initOrder()
115 $order = $this->_orderFactory->create()->load($this->getOrderId());
117 if (!
$order->getId() || $this->getProtectCode() !==
$order->getProtectCode()) {
132 $ship = $this->shipmentRepository->get($this->getShipId());
133 if (!$ship->getEntityId() || $this->getProtectCode() !== $ship->getProtectCode()) {
148 $order = $this->_initOrder();
152 $increment_id =
$shipment->getIncrementId();
157 $trackingInfos[] =
$track->getNumberDetail();
159 $shipTrack[$increment_id] = $trackingInfos;
162 $this->_trackingInfo = $shipTrack;
176 $increment_id =
$shipment->getIncrementId();
181 $trackingInfos[] =
$track->getNumberDetail();
183 $shipTrack[$increment_id] = $trackingInfos;
185 $this->_trackingInfo = $shipTrack;
194 public function getTrackingInfoByTrackId()
197 $track = $this->_trackFactory->create()->load($this->getTrackId());
198 if (
$track->getId() && $this->getProtectCode() ===
$track->getProtectCode()) {
199 $this->_trackingInfo = [[
$track->getNumberDetail()]];
210 $tracks = $this->_trackCollectionFactory->create()->setShipmentFilter(
$shipment->getId());
elseif(isset( $params[ 'redirect_parent']))
_getTracksCollection(Shipment $shipment)
__construct(\Magento\Shipping\Helper\Data $shippingData, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Api\ShipmentRepositoryInterface $shipmentRepository, \Magento\Shipping\Model\Order\TrackFactory $trackFactory, \Magento\Shipping\Model\ResourceModel\Order\Track\CollectionFactory $trackCollectionFactory, array $data=[])
setData($key, $value=null)
foreach($order->getItems() as $orderItem) $shipment