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