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


PHP Config::displayCartSubtotalInclTax方法代码示例

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


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

示例1: 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

示例2: fetch

 /**
  * Add tax totals information to address object
  *
  * @param \Magento\Quote\Model\Quote $quote
  * @param Address\Total $total
  * @return array|null
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
 {
     $totals = [];
     $store = $quote->getStore();
     $applied = $total->getAppliedTaxes();
     if (is_string($applied)) {
         $applied = unserialize($applied);
     }
     $amount = $total->getTaxAmount();
     if ($amount == null) {
         $this->enhanceTotalData($quote, $total);
         $amount = $total->getTaxAmount();
     }
     $taxAmount = $amount + $total->getTotalAmount('discount_tax_compensation');
     $area = null;
     if ($this->_config->displayCartTaxWithGrandTotal($store) && $total->getGrandTotal()) {
         $area = 'taxes';
     }
     $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:pradeep-wagento,项目名称:magento2,代码行数:44,代码来源:Tax.php

示例3: displayTotalsIncludeTax

 /**
  * Check if we need display grid totals include tax
  *
  * @return bool
  */
 public function displayTotalsIncludeTax()
 {
     $result = $this->_taxConfig->displayCartSubtotalInclTax($this->getStore()) || $this->_taxConfig->displayCartSubtotalBoth($this->getStore());
     return $result;
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:Grid.php

示例4: getTotalsConfig

 /**
  * Get totals config
  *
  * @return array
  */
 protected function getTotalsConfig()
 {
     return ['display_subtotal_incl_tax' => (int) $this->taxConfig->displayCartSubtotalInclTax(), 'display_cart_subtotal_excl_tax' => (int) $this->taxConfig->displayCartSubtotalExclTax()];
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:9,代码来源:CheckoutTotalsJsLayoutDataProvider.php

示例5: getDisplaySubtotalInclTax

 /**
  * Return whether subtotal should be displayed including tax
  *
  * @return bool
  */
 public function getDisplaySubtotalInclTax()
 {
     return $this->_taxConfig->displayCartSubtotalInclTax();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:9,代码来源:Totals.php


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