WellCommerce\Bundle\CurrencyBundle\Helper\CurrencyHelperInterface::convertAndFormat PHP Method

convertAndFormat() public method

Firts converts and then formats the amount
public convertAndFormat ( float $amount, string $baseCurrency = null, string $targetCurrency = null, integer $quantity = 1, string $locale = null ) : string
$amount float
$baseCurrency string
$targetCurrency string
$quantity integer
$locale string
return string
    public function convertAndFormat(float $amount, string $baseCurrency = null, string $targetCurrency = null, int $quantity = 1, string $locale = null) : string;

Usage Example

 protected function extractVariantData(VariantInterface $variant, array &$variants)
 {
     $sellPrice = $variant->getSellPrice();
     $baseCurrency = $sellPrice->getCurrency();
     $key = $this->getVariantOptionsKey($variant);
     $variants[$key] = ['id' => $variant->getId(), 'finalPriceGross' => $this->currencyHelper->convertAndFormat($sellPrice->getFinalGrossAmount(), $baseCurrency), 'sellPriceGross' => $this->currencyHelper->convertAndFormat($sellPrice->getGrossAmount(), $baseCurrency), 'discountPriceGross' => $this->currencyHelper->convertAndFormat($sellPrice->getDiscountedGrossAmount(), $baseCurrency), 'stock' => $variant->getStock(), 'symbol' => $variant->getSymbol(), 'options' => $this->getVariantOptions($variant)];
 }
All Usage Examples Of WellCommerce\Bundle\CurrencyBundle\Helper\CurrencyHelperInterface::convertAndFormat