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


PHP Mage_Sales_Model_Quote::getAddressesCollection方法代码示例

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


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

示例1: _getQuoteAddressForShipGroup

 /**
  * Get the quote address the ship group is the destination for.
  *
  * @param ITaxedShipGroup
  * @return Mage_Sales_Model_Quote_Address|null
  */
 protected function _getQuoteAddressForShipGroup(ITaxedShipGroup $shipGroup)
 {
     // If the destination id can be guaranteed to match between request and
     // response, the id generated for the request could be captured with the
     // address to link the destination payload back up with the quote address.
     return $this->_quote->getAddressesCollection()->getItemByColumnValue('destination_id', $shipGroup->getDestination()->getId());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:13,代码来源:Quote.php

示例2: _injectAddressData

 /**
  * Add data to the request for addresses in the quote.
  *
  * @return self
  */
 protected function _injectAddressData()
 {
     $destinationIterable = $this->_payload->getDestinations();
     $shipGroupIterable = $this->_payload->getShipGroups();
     foreach ($this->_quote->getAddressesCollection() as $address) {
         // Defer responsibility for building ship group and destination
         // payloads to address request builders.
         $addressBuilder = $this->_taxFactory->createRequestBuilderAddress($shipGroupIterable, $destinationIterable, $address);
         $destinationPayload = $addressBuilder->getDestinationPayload();
         // Billing addresses need to be set separately in the request payload.
         // The addres request builder should have created the destination
         // for the billing address, even if there were no items to add to
         // to the ship group for the billing address. E.g. a billing address
         // is still a destination so the returned payload will still have a
         // destination but may not be a valid ship group (checked separately).
         if ($address->getAddressType() === Mage_Sales_Model_Quote_Address::TYPE_BILLING) {
             $this->_payload->setBillingInformation($destinationPayload);
         }
         $shipGroupPayload = $addressBuilder->getShipGroupPayload();
         if ($shipGroupPayload) {
             $shipGroupIterable[$shipGroupPayload] = $shipGroupPayload;
         }
     }
     $this->_payload->setShipGroups($shipGroupIterable);
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:31,代码来源:Quote.php

示例3: getPgAddress

 /**
  * Gets a PakjeGemak address for either a quote or an order object.
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
  *
  * @return false|Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|TIG_MyParcel2014_Model_Shipment
  */
 public function getPgAddress($object)
 {
     /**
      * Get all addresses for the specified object.
      */
     if ($object instanceof Mage_Sales_Model_Quote) {
         $addressCollection = $object->getAllAddresses();
     } elseif ($object instanceof Mage_Sales_Model_Order) {
         $addressCollection = $object->getAddressesCollection();
     } elseif ($object instanceof TIG_MyParcel2014_Model_Shipment) {
         $order = $object->getOrder();
         if (!$order) {
             return false;
         }
         $addressCollection = $order->getAddressesCollection();
     } else {
         return false;
     }
     /**
      * Go through each address and check if it's a PakjeGemak address.
      *
      * @var Mage_Sales_Model_Quote_Address|Mage_Sales_Model_Order_Address $address
      */
     $pgAddress = false;
     foreach ($addressCollection as $address) {
         if ($address->getAddressType() == self::PG_ADDRESS_TYPE) {
             $pgAddress = $address;
             break;
         }
     }
     /**
      * Return the PakjeGemak address or false if none was found.
      */
     return $pgAddress;
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:42,代码来源:Data.php

示例4: copyQuote

 /**
  * Create duplicate of quote preserving all data (items, addresses, payment etc.)
  *
  * @param Mage_Sales_Model_Quote $quote Original Quote
  * @param bool $active Create active quote or not
  * @return Mage_Sales_Model_Quote New created quote
  */
 public function copyQuote(Mage_Sales_Model_Quote $quote, $active = false)
 {
     if (!$quote->getId()) {
         return $quote;
     }
     $newQuote = clone $quote;
     $newQuote->setId(null);
     $newQuote->setIsActive($active ? 1 : 0);
     $newQuote->save();
     // copy items with their options
     $newParentItemIds = array();
     foreach ($quote->getItemsCollection() as $item) {
         // save child items later
         if ($item->getParentItem()) {
             continue;
         }
         $oldItemId = $item->getId();
         $newItem = clone $item;
         $newItem->setQuote($newQuote);
         $newItem->save();
         $newParentItemIds[$oldItemId] = $newItem->getId();
     }
     // save childs with new parent id
     foreach ($quote->getItemsCollection() as $item) {
         if (!$item->getParentItem() || !isset($newParentItemIds[$item->getParentItemId()])) {
             continue;
         }
         $newItem = clone $item;
         $newItem->setQuote($newQuote);
         $newItem->setParentItemId($newParentItemIds[$item->getParentItemId()]);
         $newItem->save();
     }
     // copy billing and shipping addresses
     foreach ($quote->getAddressesCollection() as $address) {
         $address->setQuote($newQuote);
         $address->setId(null);
         $address->save();
     }
     // copy payment info
     foreach ($quote->getPaymentsCollection() as $payment) {
         $payment->setQuote($newQuote);
         $payment->setId(null);
         $payment->save();
     }
     return $newQuote;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:53,代码来源:Cart.php


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