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


PHP PriceCurrencyInterface::convertAndRound方法代碼示例

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


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

示例1: resolvePrice

 /**
  * @param \Magento\Framework\Pricing\SaleableInterface $product
  * @return float
  */
 public function resolvePrice(\Magento\Framework\Pricing\SaleableInterface $product)
 {
     $selectedConfigurableOption = $product->getSelectedConfigurableOption();
     if ($selectedConfigurableOption) {
         $price = $this->priceResolver->resolvePrice($selectedConfigurableOption);
     } else {
         $price = null;
         foreach ($this->configurable->getUsedProducts($product) as $subProduct) {
             $productPrice = $this->priceResolver->resolvePrice($subProduct);
             $price = $price ? min($price, $productPrice) : $productPrice;
         }
     }
     $priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
     return $priceInCurrentCurrency ? (double) $priceInCurrentCurrency : false;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:19,代碼來源:ConfigurablePriceResolver.php

示例2: getCustomAmount

 /**
  * @param float $amount
  * @param null|bool|string $exclude
  * @param null|array $context
  * @return AmountInterface|bool|float
  */
 public function getCustomAmount($amount = null, $exclude = null, $context = [])
 {
     if (null !== $amount) {
         $amount = $this->priceCurrency->convertAndRound($amount);
     } else {
         $amount = $this->getValue();
     }
     return $this->calculator->getAmount($amount, $this->getProduct(), $exclude, $context);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:15,代碼來源:AbstractPrice.php

示例3: isMinimalPriceLessMsrp

 /**
  * @param int|Product $product
  * @return bool|float
  */
 public function isMinimalPriceLessMsrp($product)
 {
     if (is_numeric($product)) {
         $product = $this->productRepository->getById($product, false, $this->storeManager->getStore()->getId());
     }
     $msrp = $product->getMsrp();
     $price = $product->getPriceInfo()->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE);
     if ($msrp === null) {
         if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) {
             return false;
         } else {
             $msrp = $product->getTypeInstance()->getChildrenMsrp($product);
         }
     }
     if ($msrp) {
         $msrp = $this->priceCurrency->convertAndRound($msrp);
     }
     return $msrp > $price->getValue();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:23,代碼來源:Data.php

示例4: getAmount

 /**
  * Obtain amount
  *
  * @param SaleableInterface $saleableItem
  * @return float
  */
 protected function getAmount(SaleableInterface $saleableItem)
 {
     $weeeAmount = $this->weeeHelper->getAmount($saleableItem);
     $weeeAmount = $this->priceCurrency->convertAndRound($weeeAmount);
     return $weeeAmount;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:12,代碼來源:Adjustment.php


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