当前位置: 首页>>代码示例>>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;未经允许,请勿转载。