當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Quote::getAllAddresses方法代碼示例

本文整理匯總了PHP中Magento\Quote\Model\Quote::getAllAddresses方法的典型用法代碼示例。如果您正苦於以下問題:PHP Quote::getAllAddresses方法的具體用法?PHP Quote::getAllAddresses怎麽用?PHP Quote::getAllAddresses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Quote\Model\Quote的用法示例。


在下文中一共展示了Quote::getAllAddresses方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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) {
         $address->unsetData('cached_items_all');
         $address->unsetData('cached_items_nominal');
         $address->unsetData('cached_items_nonominal');
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:12,代碼來源:Quote.php

示例2: testGetAllAddresses

 public function testGetAllAddresses()
 {
     $id = 1;
     $this->quoteAddressCollectionMock->expects($this->once())->method('setQuoteFilter')->with($id)->will($this->returnSelf());
     $this->quoteAddressMock->expects($this->once())->method('isDeleted')->will($this->returnValue(false));
     $iterator = new \ArrayIterator([$this->quoteAddressMock]);
     $this->quoteAddressCollectionMock->expects($this->any())->method('getIterator')->will($this->returnValue($iterator));
     $this->quote->setId($id);
     $result = $this->quote->getAllAddresses();
     $this->assertEquals([$this->quoteAddressMock], $result);
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:11,代碼來源:QuoteTest.php

示例3: enhanceTotalData

 /**
  * Adds minimal tax information to the "total" data structure
  *
  * @param \Magento\Quote\Model\Quote $quote
  * @param Address\Total $total
  * @return null
  */
 protected function enhanceTotalData(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
 {
     $taxAmount = 0;
     $shippingTaxAmount = 0;
     $discountTaxCompensation = 0;
     $subtotalInclTax = $total->getSubtotalInclTax();
     $computeSubtotalInclTax = true;
     if ($total->getSubtotalInclTax() > 0) {
         $computeSubtotalInclTax = false;
     }
     /** @var \Magento\Quote\Model\Quote\Address $address */
     foreach ($quote->getAllAddresses() as $address) {
         $taxAmount += $address->getTaxAmount();
         $shippingTaxAmount += $address->getShippingTaxAmount();
         $discountTaxCompensation += $address->getDiscountTaxCompensationAmount();
         if ($computeSubtotalInclTax) {
             $subtotalInclTax += $address->getSubtotalInclTax();
         }
     }
     $total->setTaxAmount($taxAmount);
     $total->setShippingTaxAmount($shippingTaxAmount);
     $total->setDiscountTaxCompensationAmount($discountTaxCompensation);
     // accessed via 'discount_tax_compensation'
     $total->setSubtotalInclTax($subtotalInclTax);
     return;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:33,代碼來源:Tax.php

示例4: _validateCouponCode

 /**
  * @param \Magento\Quote\Model\Quote $quote
  * @return $this
  */
 protected function _validateCouponCode(\Magento\Quote\Model\Quote $quote)
 {
     $code = $quote->getData('coupon_code');
     if (strlen($code)) {
         $addressHasCoupon = false;
         $addresses = $quote->getAllAddresses();
         if (count($addresses) > 0) {
             foreach ($addresses as $address) {
                 if ($address->hasCouponCode()) {
                     $addressHasCoupon = true;
                 }
             }
             if (!$addressHasCoupon) {
                 $quote->setCouponCode('');
             }
         }
     }
     return $this;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:23,代碼來源:TotalsCollector.php


注:本文中的Magento\Quote\Model\Quote::getAllAddresses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。