Exemplo n.º 1
0
 /**
  * @param Mage_Sales_Model_Order $order
  * @return array
  */
 protected function _getDeliveryNotes($order)
 {
     $deliveryNotes = array();
     foreach ($order->getShipmentsCollection() as $shipment) {
         /** @var Mage_Sales_Model_Order_Shipment $shipment */
         foreach ($shipment->getAllTracks() as $track) {
             /** @var Mage_Sales_Model_Order_Shipment_Track $track */
             $note = new ShopgateDeliveryNote();
             $note->setShippingServiceId($track->getTitle());
             $note->setTrackingNumber($track->getNumber());
             $note->setShippingTime($track->getCreatedAt());
             array_push($deliveryNotes, $note);
         }
     }
     return $deliveryNotes;
 }
Exemplo n.º 2
0
 /**
  * @param OrderCore $order
  *
  * @return array
  */
 protected function _getDeliveryNotes($order)
 {
     $result = array();
     if (method_exists($order, 'getShipping')) {
         foreach ($order->getShipping() as $item) {
             /** @var OrderCarrierCore $orderCarrier */
             $orderCarrier = new OrderCarrier($item['id_order_carrier']);
             /** @var CarrierCore $carrier */
             $carrier = new Carrier($orderCarrier->id_carrier);
             $deliveryNote = new ShopgateDeliveryNote();
             $deliveryNote->setShippingServiceId($carrier->name);
             $deliveryNote->setTrackingNumber($orderCarrier->tracking_number ? $orderCarrier->tracking_number : null);
             $deliveryNote->setShippingTime($orderCarrier->date_add);
             $result[] = $deliveryNote;
         }
     }
     return $result;
 }