Esempio n. 1
0
 /**
  * @param Shipment $shipment
  * @return \Magento\Shipping\Model\ResourceModel\Order\Track\Collection
  */
 protected function _getTracksCollection(Shipment $shipment)
 {
     $tracks = $this->_trackCollectionFactory->create()->setShipmentFilter($shipment->getId());
     if ($shipment->getId()) {
         foreach ($tracks as $track) {
             $track->setShipment($shipment);
         }
     }
     return $tracks;
 }
Esempio n. 2
0
 /**
  * Returns tracks
  *
  * @return \Magento\Sales\Api\Data\ShipmentTrackInterface[]
  */
 public function getTracks()
 {
     if ($this->getData(ShipmentInterface::TRACKS) === null) {
         $collection = $this->_trackCollectionFactory->create()->setShipmentFilter($this->getId());
         if ($this->getId()) {
             foreach ($collection as $item) {
                 $item->setShipment($this);
             }
             $this->setData(ShipmentInterface::TRACKS, $collection->getItems());
         }
     }
     return $this->getData(ShipmentInterface::TRACKS);
 }
Esempio n. 3
0
    /**
     * Retrieve order tracking numbers collection
     *
     * @return TrackCollection
     */
    public function getTracksCollection()
    {
        if (empty($this->_tracks)) {
            $this->_tracks = $this->_trackCollectionFactory->create()->setOrderFilter($this);

            if ($this->getId()) {
                $this->_tracks->load();
            }
        }
        return $this->_tracks;
    }