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