当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order_Shipment::getAllTracks方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Shipment::getAllTracks方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Shipment::getAllTracks方法的具体用法?PHP Mage_Sales_Model_Order_Shipment::getAllTracks怎么用?PHP Mage_Sales_Model_Order_Shipment::getAllTracks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Shipment的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Shipment::getAllTracks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateShipmentArray

 public function generateShipmentArray(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $address = $shipment->getShippingAddress();
     $trackingMethods = $shipment->getAllTracks();
     $primaryTrack = count($trackingMethods) ? $trackingMethods[0] : false;
     $array = array('@context' => 'http://schema.org', '@type' => 'ParcelDelivery', 'deliveryAddress' => array('@type' => 'PostalAddress', 'streetAddress' => $address->getStreetFull(), 'addressLocality' => $address->getCity(), 'addressRegion' => $address->getRegionCode(), 'addressCountry' => $address->getCountry(), 'postalCode' => $address->getPostcode()), 'partOfOrder' => $this->generateOrderArray($shipment->getOrder()), "expectedArrivalUntil" => date("c", time() + 60 * 60 * 24 * 365.25));
     if (count($trackingMethods)) {
         $array['carrier'] = $primaryTrack->getTitle();
         $array['trackingNumber'] = $primaryTrack->getNumber();
         $array['trackingUrl'] = $this->helper('shipping')->getTrackingPopUpUrlByTrackId($primaryTrack->getId());
     }
     return $array;
 }
开发者ID:salsero35,项目名称:gmailactions,代码行数:13,代码来源:Shipment.php

示例2: _createShipmentInfo

 protected function _createShipmentInfo(Mage_Sales_Model_Order_Shipment $shipment)
 {
     $result = array('shipmentId' => $shipment->getIncrementId(), 'shippingFees' => array('amount' => '0', 'code' => Mage::app()->getStore()->getBaseCurrencyCode()), 'discountAmount' => null, 'discounts' => null, 'additionalCost' => null, 'packagingHandlingCost' => null, 'surcharge' => null, 'trackingDetails' => $this->_createTrackingInfo($shipment->getAllTracks()), 'shippingMethod' => $shipment->getOrder()->getShippingDescription(), 'deliveryWindow' => null, 'shippingWindow' => null, 'shippingMessage' => null);
     return $result;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:5,代码来源:Marketplaceshipment.php

示例3: confirmShipment

 /**
  * Confirm crating of shipment
  *
  * @param Mage_Sales_Model_Order_Shipment $shipment
  * @return Mage_AmazonPayments_Model_Api_Cba
  */
 public function confirmShipment($shipment)
 {
     $items = array();
     foreach ($shipment->getAllItems() as $item) {
         /* @var $item Mage_Sales_Model_Order_Shipment_Item */
         if ($item->getOrderItem()->getParentItemId()) {
             continue;
         }
         $items[] = array('id' => $item->getOrderItem()->getExtOrderItemId(), 'qty' => $item->getQty());
     }
     $carrierName = '';
     $shippingMethod = '';
     $trackNumber = '';
     /**
      * Magento track numbers is not connected with items.
      * Get only first track number
      */
     foreach ($shipment->getAllTracks() as $track) {
         $carrierName = $track->getTitle();
         $trackNumber = $track->getNumber();
         break;
     }
     if (preg_match("/\\((.+)\\)/", $shipment->getOrder()->getShippingDescription(), $_result)) {
         $shippingMethod = $_result[1];
     }
     $this->getDocumentApi()->confirmShipment($shipment->getOrder()->getExtOrderId(), $carrierName, $shippingMethod, $items, $trackNumber);
     $shipment->addComment(Mage::helper('amazonpayments')->__('Shipment was created with Checkout by Amazon.'));
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:35,代码来源:Cba.php

示例4: sendShipment

 /**
  * Send order shipment to Rakuten Checkout
  *
  * @param  Mage_Sales_Model_Order_Shipment $shipment
  * @return bool
  * @throws Exception|Mage_Core_Exception
  */
 public function sendShipment($shipment)
 {
     // Create Rakuten Checkout Send Order Shipment XML request
     $xml = new SimpleXMLElement("<?xml version='1.0' encoding='UTF-8' ?><tradoria_order_shipment />");
     $merchantAuth = $xml->addChild('merchant_authentication');
     $merchantAuth->addChild('project_id', $this->_projectId);
     $merchantAuth->addChild('api_key', $this->_apiKey);
     /** @var $order Mage_Sales_Model_Order */
     $order = $shipment->getOrder();
     $xml->addChild('order_no', $order->getExtOrderId());
     $carrierTrackingId = $xml->addChild('carrier_tracking_id');
     $carrierTrackingUrl = $xml->addChild('carrier_tracking_url');
     $carrierTrackingCode = $xml->addChild('carrier_tracking_code');
     if ($tracks = $shipment->getAllTracks()) {
         /** @var $track Mage_Sales_Model_Order_Shipment_Track */
         $track = array_shift($tracks);
         // Multiple tracking codes for one shipment are supported by Magento
         $this->_addCDATA($carrierTrackingId, $track->getCarrierCode());
         $this->_addCDATA($carrierTrackingCode, $track->getNumber());
     }
     $request = $xml->asXML();
     $response = $this->sendRequest($request, 'shipment');
     try {
         $response = new SimpleXMLElement($response);
         if ($response->success != 'true') {
             throw new Mage_Core_Exception((string) $response->message, (int) $response->code);
         } else {
             if ((string) $response->invoice_number != '') {
                 $comment = Mage::helper('rakuten')->__('Rakuten Invoice No: %s', '<strong>' . (string) $response->invoice_number . '</strong><br />');
                 $shipment->addComment($comment);
                 $order->addStatusHistoryComment($comment);
             }
         }
     } catch (Mage_Core_Exception $e) {
         throw $e;
     } catch (Exception $e) {
         Mage::logException($e);
         throw $e;
     }
     return true;
 }
开发者ID:rakuten-deutschland,项目名称:checkout-magento,代码行数:48,代码来源:Checkout.php


注:本文中的Mage_Sales_Model_Order_Shipment::getAllTracks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。