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


PHP Mage_Sales_Model_Quote::getAllAddresses方法代码示例

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


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

示例1: clearQuoteItemsCache

 /**
  * Mage_Sales_Model_Quote_Address caches items after each collectTotals call. Some extensions calls collectTotals
  * after adding new item to quote in observers. So we need clear this cache before adding new item to quote.
  */
 private function clearQuoteItemsCache()
 {
     foreach ($this->quote->getAllAddresses() as $address) {
         /** @var $address Mage_Sales_Model_Quote_Address */
         $address->unsetData('cached_items_all');
         $address->unsetData('cached_items_nominal');
         $address->unsetData('cached_items_nonominal');
     }
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:13,代码来源:Quote.php

示例2: detectWorstAddressScoreByQuote

 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return array
  */
 public function detectWorstAddressScoreByQuote(Mage_Sales_Model_Quote $quote)
 {
     $quoteAddresses = $quote->getAllAddresses();
     $addressScores = array();
     foreach ($quoteAddresses as $address) {
         /** @var $address Mage_Sales_Model_Quote_Address */
         $addressScores[] = $address->getPayoneAddresscheckScore();
     }
     return $this->detectWorstScore($addressScores);
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:14,代码来源:Score.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: _validateQuote

 /**
  * Determine if taxes can be collected for the quote.
  *
  * @param Mage_Sales_Model_Quote
  * @return self
  * @throws EbayEnterprise_Tax_Exception_Collector_InvalidQuote_Exception If the quote is not valid for making a tax request.
  */
 protected function _validateQuote(Mage_Sales_Model_Quote $quote)
 {
     // At a minimum, the quote must have at least one item and a billing
     // address with usable information. Currently, a spot check of address
     // data *should* be useful enough to separate a complete address from
     // an incomplete address.
     $billingAddress = $quote->getBillingAddress();
     if ($quote->getItemsCount() && $billingAddress->getFirstname() && $billingAddress->getLastname() && $billingAddress->getStreetFull() && $billingAddress->getCountryId()) {
         return $this->_validateAddresses($quote->getAllAddresses());
     }
     throw Mage::exception('EbayEnterprise_Tax_Exception_Collector_InvalidQuote', 'Quote invalid for tax collection.');
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:19,代码来源:Collector.php

示例5: _setQuoteShopCoupons

 /**
  * Add coupon from this system to quote
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param ShopgateCartBase       $order
  *
  * @return Mage_Sales_Model_Quote
  * @throws ShopgateLibraryException
  */
 protected function _setQuoteShopCoupons($quote, $order)
 {
     if (count($order->getExternalCoupons()) > 1) {
         throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_TOO_MANY_COUPONS);
     }
     foreach ($order->getExternalCoupons() as $coupon) {
         /* @var $coupon ShopgateShopgateCoupon */
         $couponInfos = $this->jsonDecode($coupon->getInternalInfo(), true);
         if ($order instanceof ShopgateOrder) {
             if (!$coupon->getInternalInfo()) {
                 throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Field "internal_info" is empty.');
             }
             /** @var Mage_SalesRule_Model_Coupon $mageCoupon */
             if ($this->_getConfigHelper()->getIsMagentoVersionLower1410()) {
                 $mageCoupon = Mage::getModel('salesrule/rule')->load($couponInfos["coupon_id"]);
             } else {
                 $mageCoupon = Mage::getModel('salesrule/coupon')->load($couponInfos["coupon_id"]);
             }
             $count = (int) $mageCoupon->getTimesUsed();
             $count--;
             $mageCoupon->setTimesUsed($count);
             $mageCoupon->save();
         }
         $quote->setCouponCode($coupon->getCode());
         foreach ($quote->getAllAddresses() as $address) {
             $address->setCouponCode($coupon->getCode());
         }
         $quote->setTotalsCollectedFlag(false);
         $quote->collectTotals();
         if ($this->_errorOnInvalidCoupon) {
             if ($coupon->getCode() != $quote->getCouponCode()) {
                 throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Code transferred by Shopgate"' . $coupon->getCode() . '" != "' . $quote->getCouponCode() . '" code in Magento');
             }
         }
         $quote->save();
     }
     return $quote;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:47,代码来源:Plugin.php

示例6: removePgAddress

 /**
  * Removes a saved PakjeGemak address from the quote.
  *
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return $this
  * @throws Exception
  */
 public function removePgAddress(Mage_Sales_Model_Quote $quote)
 {
     if ($quote) {
         if ($quote != '{}') {
             $addresses = $quote->getAllAddresses();
             /** @var Mage_Sales_Model_Quote_Address $address */
             foreach ($addresses as $address) {
                 if ($address->getAddressType() == TIG_MyParcel2014_Helper_Data::PG_ADDRESS_TYPE) {
                     $address->delete();
                 }
             }
         }
     }
     return $this;
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:23,代码来源:Service.php


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