當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。