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


PHP Config::crossBorderTradeEnabled方法代碼示例

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


在下文中一共展示了Config::crossBorderTradeEnabled方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isSameRateAsStore

 /**
  * Check if tax rate is same as store tax rate
  *
  * @param float $rate
  * @param float $storeRate
  * @return bool
  */
 protected function isSameRateAsStore($rate, $storeRate)
 {
     if ((bool) $this->config->crossBorderTradeEnabled($this->storeId)) {
         return true;
     } else {
         return abs($rate - $storeRate) < 1.0E-5;
     }
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:AbstractCalculator.php

示例2: calculateTax

 /**
  * {@inheritdoc}
  */
 public function calculateTax(QuoteDetails $quoteDetails, $storeId = null)
 {
     if (is_null($storeId)) {
         $storeId = $this->storeManager->getStore()->getStoreId();
     }
     // initial TaxDetails data
     $taxDetailsData = [TaxDetails::KEY_SUBTOTAL => 0.0, TaxDetails::KEY_TAX_AMOUNT => 0.0, TaxDetails::KEY_DISCOUNT_TAX_COMPENSATION_AMOUNT => 0.0, TaxDetails::KEY_APPLIED_TAXES => [], TaxDetails::KEY_ITEMS => []];
     $items = $quoteDetails->getItems();
     if (empty($items)) {
         return $this->taxDetailsBuilder->populateWithArray($taxDetailsData)->create();
     }
     $this->computeRelationships($items);
     $addressRequest = $this->getAddressTaxRequest($quoteDetails, $storeId, $quoteDetails->getCustomerId());
     if ($this->config->priceIncludesTax($storeId)) {
         $storeRequest = $this->getStoreTaxRequest($storeId);
         $classIds = [];
         foreach ($items as $item) {
             if ($item->getTaxClassId()) {
                 $classIds[] = $item->getTaxClassId();
             }
         }
         $classIds = array_unique($classIds);
         $addressRequest->setProductClassId($classIds);
         $storeRequest->setProductClassId($classIds);
         if ((bool) $this->config->crossBorderTradeEnabled($storeId)) {
             $addressRequest->setSameRateAsStore(true);
         } else {
             $addressRequest->setSameRateAsStore($this->calculator->compareRequests($storeRequest, $addressRequest));
         }
     }
     // init rounding deltas for this quote
     $this->roundingDeltas = [];
     // init discount tax compensations array
     $this->discountTaxCompensations = [];
     $processedItems = [];
     /** @var QuoteDetailsItem $item */
     foreach ($this->keyedItems as $item) {
         if (isset($this->parentToChildren[$item->getCode()])) {
             $processedChildren = [];
             foreach ($this->parentToChildren[$item->getCode()] as $child) {
                 $processedItem = $this->processItem($child, $addressRequest, $storeId);
                 $taxDetailsData = $this->aggregateItemData($taxDetailsData, $processedItem);
                 $processedItems[$processedItem->getCode()] = $processedItem;
                 $processedChildren[] = $processedItem;
             }
             $processedItemBuilder = $this->calculateParent($processedChildren, $item->getQuantity());
             $processedItemBuilder->setCode($item->getCode());
             $processedItemBuilder->setType($item->getType());
             $processedItem = $processedItemBuilder->create();
         } else {
             $processedItem = $this->processItem($item, $addressRequest, $storeId);
             $taxDetailsData = $this->aggregateItemData($taxDetailsData, $processedItem);
         }
         $processedItems[$processedItem->getCode()] = $processedItem;
     }
     return $this->taxDetailsBuilder->populateWithArray($taxDetailsData)->setItems($processedItems)->create();
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:60,代碼來源:TaxCalculationService.php

示例3: isCrossBorderTradeEnabled

 /**
  * Return whether cross border trade is enabled or not
  *
  * @param   null|int|string|Store $store
  * @return  bool
  */
 public function isCrossBorderTradeEnabled($store = null)
 {
     return (bool) $this->_config->crossBorderTradeEnabled($store);
 }
開發者ID:zhangjiachao,項目名稱:magento2,代碼行數:10,代碼來源:Data.php

示例4: _isCrossBorderTradeEnabled

 /**
  * Return whether cross border trade is enabled or not
  *
  * @param   null|int|string|Store $store
  * @return  bool
  */
 protected function _isCrossBorderTradeEnabled($store = null)
 {
     return (bool) $this->_config->crossBorderTradeEnabled($store);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:10,代碼來源:Calculation.php


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