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