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


PHP Data::displayBothPrices方法代碼示例

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


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

示例1: displayBothPrices

 /**
  * Check if we have display prices including and excluding tax
  * With corrections for Dynamic prices
  *
  * @return bool
  */
 public function displayBothPrices()
 {
     $product = $this->getProduct();
     if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC && $product->getPriceModel()->getIsPricesCalculatedByIndex() !== false) {
         return false;
     }
     return $this->_taxHelper->displayBothPrices();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:Price.php

示例2: afterPrepareAdjustmentConfig

 /**
  * Get Tax Adjustments for configurable product
  *
  * @param \Magento\ConfigurableProduct\Pricing\Price\AttributePrice $attribute
  * @param array $result
  * @return array
  */
 public function afterPrepareAdjustmentConfig(\Magento\ConfigurableProduct\Pricing\Price\AttributePrice $attribute, array $result)
 {
     $product = $result['product'];
     $productClassId = $product->getTaxClassId();
     $defaultValue = $this->taxCalculationService->getDefaultCalculatedRate($productClassId, $result['customerId']);
     $result['defaultTax'] = $defaultValue + $result['defaultTax'];
     $currentTax = $this->taxCalculationService->getCalculatedRate($productClassId, $result['customerId']);
     $result['currentTax'] = $currentTax + $result['currentTax'];
     $adjustment = $product->getPriceInfo()->getAdjustment(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE);
     $result['includeTax'] = $adjustment->isIncludedInBasePrice();
     $result['showIncludeTax'] = $this->taxHelper->displayPriceIncludingTax();
     $result['showBothPrices'] = $this->taxHelper->displayBothPrices();
     return $result;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:21,代碼來源:AttributePrice.php

示例3: execute

 /**
  * Change default JavaScript templates for options rendering
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $response = $observer->getEvent()->getResponseObject();
     $options = $response->getAdditionalOptions();
     $_product = $this->registry->registry('current_product');
     if (!$_product) {
         return $this;
     }
     $algorithm = $this->taxData->getCalculationAlgorithm();
     $options['calculationAlgorithm'] = $algorithm;
     // prepare correct template for options render
     if ($this->taxData->displayBothPrices()) {
         $options['optionTemplate'] = sprintf('<%%= data.label %%>' . '<%% if (data.finalPrice.value) { %%>' . ' +<%%= data.finalPrice.formatted %%> (%1$s <%%= data.basePrice.formatted %%>)' . '<%% } %%>', __('Excl. tax:'));
     } elseif ($this->taxData->priceIncludesTax() && $this->taxData->displayPriceExcludingTax()) {
         $options['optionTemplate'] = sprintf('<%%= data.label %%>' . '<%% if (data.basePrice.value) { %%>' . ' +<%%= data.basePrice.formatted %%>' . '<%% } %%>');
     }
     $response->setAdditionalOptions($options);
     return $this;
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:25,代碼來源:UpdateProductOptionsObserver.php

示例4: displayBothPrices

 /**
  * Define if both prices should be displayed
  *
  * @return bool
  */
 public function displayBothPrices()
 {
     return $this->taxHelper->displayBothPrices();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:9,代碼來源:Adjustment.php

示例5: isIncludedInDisplayPrice

 /**
  * Define if adjustment is included in display price
  *
  * @return bool
  */
 public function isIncludedInDisplayPrice()
 {
     return $this->taxHelper->displayPriceIncludingTax() || $this->taxHelper->displayBothPrices();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:9,代碼來源:Adjustment.php


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