本文整理匯總了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;
}
}
示例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();
}
示例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);
}
示例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);
}