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