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


PHP Config::displayCartZeroTax方法代码示例

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


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

示例1: aroundProcess

 /**
  * @param \Magento\Quote\Model\Cart\TotalsConverter $subject
  * @param \Closure $proceed
  * @param \Magento\Quote\Model\Quote\Address\Total[] $addressTotals
  * @return \Magento\Quote\Api\Data\TotalSegmentInterface[]
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundProcess(\Magento\Quote\Model\Cart\TotalsConverter $subject, \Closure $proceed, array $addressTotals = [])
 {
     $totalSegments = $proceed($addressTotals);
     if (!array_key_exists($this->code, $addressTotals)) {
         return $totalSegments;
     }
     $taxes = $addressTotals['tax']->getData();
     if (!array_key_exists('full_info', $taxes)) {
         return $totalSegments;
     }
     $detailsId = 1;
     $finalData = [];
     foreach (unserialize($taxes['full_info']) as $info) {
         if (array_key_exists('hidden', $info) && $info['hidden'] || $info['amount'] == 0 && $this->taxConfig->displayCartZeroTax()) {
             continue;
         }
         $taxDetails = $this->detailsFactory->create([]);
         $taxDetails->setAmount($info['amount']);
         $taxRates = $this->getRatesData($info['rates']);
         $taxDetails->setRates($taxRates);
         $taxDetails->setGroupId($detailsId);
         $finalData[] = $taxDetails;
         $detailsId++;
     }
     $attributes = $totalSegments[$this->code]->getExtensionAttributes();
     if ($attributes === null) {
         $attributes = $this->totalSegmentExtensionFactory->create();
     }
     $attributes->setTaxGrandtotalDetails($finalData);
     $totalSegments[$this->code]->setExtensionAttributes($attributes);
     return $totalSegments;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:39,代码来源:GrandTotalDetailsPlugin.php

示例2: aroundGet

 /**
  * @param CartTotalRepository $subject
  * @param \Closure $proceed
  * @param int $cartId
  * @return \Magento\Quote\Model\Cart\Totals
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundGet(CartTotalRepository $subject, \Closure $proceed, $cartId)
 {
     $result = $proceed($cartId);
     $quote = $this->quoteRepository->getActive($cartId);
     $totals = $quote->getTotals();
     if (!array_key_exists('tax', $totals)) {
         return $result;
     }
     $taxes = $totals['tax']->getData();
     if (!array_key_exists('full_info', $taxes)) {
         return $result;
     }
     $detailsId = 1;
     $finalData = [];
     foreach ($taxes['full_info'] as $info) {
         if (array_key_exists('hidden', $info) && $info['hidden'] || $info['amount'] == 0 && $this->taxConfig->displayCartZeroTax()) {
             continue;
         }
         $taxDetails = $this->detailsFactory->create([]);
         $taxDetails->setAmount($info['amount']);
         $taxRates = $this->getRatesData($info['rates']);
         $taxDetails->setRates($taxRates);
         $taxDetails->setGroupId($detailsId);
         $finalData[] = $taxDetails;
         $detailsId++;
     }
     $attributes = $result->getExtensionAttributes();
     if ($attributes === null) {
         $attributes = $this->extensionFactory->create();
     }
     $attributes->setTaxGrandtotalDetails($finalData);
     /** @var $result \Magento\Quote\Model\Cart\Totals */
     $result->setExtensionAttributes($attributes);
     return $result;
 }
开发者ID:nja78,项目名称:magento2,代码行数:43,代码来源:GrandTotalDetailsPlugin.php

示例3: fetch

 /**
  * Add tax totals information to address object
  *
  * @param \Magento\Quote\Model\Quote $quote
  * @param Address\Total $total
  * @return array|null
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
 {
     $totals = [];
     $store = $quote->getStore();
     $applied = $total->getAppliedTaxes();
     $amount = $total->getTaxAmount();
     $taxAmount = $amount + $total->getTotalAmount('discount_tax_compensation');
     $area = null;
     if ($this->_config->displayCartTaxWithGrandTotal($store) && $total->getGrandTotal()) {
         $area = 'taxes';
     }
     if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
         $totals[] = ['code' => $this->getCode(), 'title' => __('Tax'), 'full_info' => $applied ? $applied : [], 'value' => $amount, 'area' => $area];
     }
     /**
      * Modify subtotal
      */
     if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
         if ($total->getSubtotalInclTax() > 0) {
             $subtotalInclTax = $total->getSubtotalInclTax();
         } else {
             $subtotalInclTax = $total->getSubtotal() + $taxAmount - $total->getShippingTaxAmount();
         }
         $totals[] = ['code' => 'subtotal', 'title' => __('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $total->getSubtotal()];
     }
     if (empty($totals)) {
         return null;
     }
     return $totals;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:38,代码来源:Tax.php

示例4: fetch

 /**
  * Add tax totals information to address object
  *
  * @param   Address $address
  * @return  $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function fetch(Address $address)
 {
     $applied = $address->getAppliedTaxes();
     $store = $address->getQuote()->getStore();
     $amount = $address->getTaxAmount();
     $items = $this->_getAddressItems($address);
     $discountTaxCompensation = 0;
     foreach ($items as $item) {
         $discountTaxCompensation += $item->getDiscountTaxCompensation();
     }
     $taxAmount = $amount + $discountTaxCompensation;
     $area = null;
     if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
         $area = 'taxes';
     }
     if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
         $address->addTotal(['code' => $this->getCode(), 'title' => __('Tax'), 'full_info' => $applied ? $applied : [], 'value' => $amount, 'area' => $area]);
     }
     $store = $address->getQuote()->getStore();
     /**
      * Modify subtotal
      */
     if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
         if ($address->getSubtotalInclTax() > 0) {
             $subtotalInclTax = $address->getSubtotalInclTax();
         } else {
             $subtotalInclTax = $address->getSubtotal() + $taxAmount - $address->getShippingTaxAmount();
         }
         $address->addTotal(['code' => 'subtotal', 'title' => __('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()]);
     }
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:39,代码来源:Tax.php

示例5: getConfig

 /**
  * {@inheritdoc}
  */
 public function getConfig()
 {
     return ['isDisplayShippingPriceExclTax' => $this->isDisplayShippingPriceExclTax(), 'isDisplayShippingBothPrices' => $this->isDisplayShippingBothPrices(), 'reviewShippingDisplayMode' => $this->getDisplayShippingMode(), 'reviewItemPriceDisplayMode' => $this->getReviewItemPriceDisplayMode(), 'reviewTotalsDisplayMode' => $this->getReviewTotalsDisplayMode(), 'includeTaxInGrandTotal' => $this->isTaxDisplayedInGrandTotal(), 'isFullTaxSummaryDisplayed' => $this->isFullTaxSummaryDisplayed(), 'isZeroTaxDisplayed' => $this->taxConfig->displayCartZeroTax(), 'reloadOnBillingAddress' => $this->reloadOnBillingAddress(), 'defaultCountryId' => $this->scopeConfig->getValue(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE), 'defaultRegionId' => $this->scopeConfig->getValue(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE), 'defaultPostcode' => $this->scopeConfig->getValue(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:TaxConfigProvider.php

示例6: displayZeroTax

 /**
  * Check if need display zero tax in subtotal
  *
  * @param null|int|string|Store $store
  * @return bool
  */
 public function displayZeroTax($store = null)
 {
     return $this->_config->displayCartZeroTax($store);
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:10,代码来源:Data.php

示例7: getConfig

 /**
  * {@inheritdoc}
  */
 public function getConfig()
 {
     return ['isDisplayShippingPriceExclTax' => $this->isDisplayShippingPriceExclTax(), 'isDisplayShippingBothPrices' => $this->isDisplayShippingBothPrices(), 'reviewShippingDisplayMode' => $this->getDisplayShippingMode(), 'reviewItemPriceDisplayMode' => $this->getReviewItemPriceDisplayMode(), 'reviewTotalsDisplayMode' => $this->getReviewTotalsDisplayMode(), 'includeTaxInGrandTotal' => $this->isTaxDisplayedInGrandTotal(), 'isFullTaxSummaryDisplayed' => $this->isFullTaxSummaryDisplayed(), 'isZeroTaxDisplayed' => $this->taxConfig->displayCartZeroTax(), 'reloadOnBillingAddress' => $this->reloadOnBillingAddress()];
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:7,代码来源:TaxConfigProvider.php


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