CoolCMS API

ApproxPriceLatteExtension extends Extension
in package

FinalYes

Approximate price conversion into the website currency (`CurrencyContext::getCurrency()`).

{$price|approxPrice:$currency} renders e.g. "≈ €4,100" (with a translated "approximately" for screen readers), or an empty string when the currencies match or the conversion is impossible (ApproximatePrice::convert()). The original price is still rendered by priceFormat; this filter only adds to it. A second argument true wraps the result in parentheses preceded by a non-breaking space (advert list look), so in a template the filter goes right after the original price, without a space.

currencyById($id) returns a currency from CurrencyContext::getCurrencies() by id (an advert price currency is an entity-attribute-value parameter, the template only has its id).

Table of Contents

Constants

TRANSLATION_KEY  : mixed = 'front.general.price.approximately'

Properties

$appContext  : AppContext
$priceFormatContext  : PriceFormatContext
$translator  : ITranslator
$unitFormatter  : CurrencyUnitFormatter

Methods

__construct()  : mixed
getFilters()  : array<string|int, mixed>
getFunctions()  : array<string|int, mixed>
currencyById()  : object|null
render()  : Html|string

Constants

Properties

Methods

currencyById()

private currencyById(int|string|null $id) : object|null
Parameters
$id : int|string|null
Return values
object|null

render()

private render(float|int|string|null $price, object|null $currency, bool $parentheses) : Html|string
Parameters
$price : float|int|string|null
$currency : object|null
$parentheses : bool
Return values
Html|string
On this page

Search results