CoolCMS API

CurrencyContext
in package

Table of Contents

Properties

$curr  : int|string|null
$currencies  : array<string|int, object>
$currency  : object|null
$localizationPaymentRegion  : object|null
$pageCurrency  : object|null
Page currency override (null falls back to the display region currency, {@see getCurrency()}).
$paymentRegion  : object|null
Payment region that prices are displayed in (currency + VAT), see {@see \App\Core\Utils\Helpers\DisplayRegionResolver}.
$paymentRegions  : array<int, object>

Methods

__construct()  : mixed
getCurr()  : int|string|null
getCurrencies()  : array<string|int, object>
getCurrency()  : object|null
getLocalizationPaymentRegion()  : object|null
Returns the localization region (ignoring the customer's choice in an order).
getPageCurrency()  : object|null
Returns the currency the page shows prices in.
getPaymentRegion()  : object|null
getPaymentRegionId()  : int|null
getPaymentRegions()  : array<int, object>
setCurr()  : self
setCurrencies()  : self
setCurrency()  : self
setLocalizationPaymentRegion()  : self
setPageCurrency()  : self
Sets the currency the page shows prices in (null reverts to the display region currency).
setPaymentRegion()  : self
setPaymentRegions()  : self

Properties

$localizationPaymentRegion

private object|null $localizationPaymentRegion = null

$pageCurrency

Page currency override (null falls back to the display region currency, {@see getCurrency()}).

private object|null $pageCurrency = null

Set only by pages that show prices in a currency other than the catalog one: the cart and the order (CheckoutRegionTrait), payment pages (gateway currency), the response detail (response currency). See getPageCurrency().

$paymentRegion

Payment region that prices are displayed in (currency + VAT), see {@see \App\Core\Utils\Helpers\DisplayRegionResolver}.

private object|null $paymentRegion = null

The front end fills it from the localization region (CurrencyInitTrait::initializeDisplayRegion()); the cart and the order may use a region chosen by the customer, in which case getLocalizationPaymentRegion() still returns the localization region (used for the recalculation notice).

$paymentRegions

private array<int, object> $paymentRegions = []

active payment regions (for choosing the region in an order)

Methods

__construct()

public __construct(Request $httpRequest) : mixed
Parameters
$httpRequest : Request

getCurr()

public getCurr() : int|string|null
Return values
int|string|null

getCurrencies()

public getCurrencies() : array<string|int, object>
Return values
array<string|int, object>

getCurrency()

public getCurrency() : object|null
Return values
object|null

getLocalizationPaymentRegion()

Returns the localization region (ignoring the customer's choice in an order).

public getLocalizationPaymentRegion() : object|null
Return values
object|null

getPageCurrency()

Returns the currency the page shows prices in.

public getPageCurrency() : object|null

IMPORTANT: this is the only currency source for front end JS (data-currency-* in parts/shared/scripts.latte, Latte function pageCurrency()). It is the order region currency on the cart and order pages, the localization region currency elsewhere; templates only read it. Otherwise formatPrice() in JS prints euros next to PHP-formatted crowns.

Return values
object|null

getPaymentRegion()

public getPaymentRegion() : object|null
Return values
object|null

getPaymentRegionId()

public getPaymentRegionId() : int|null
Return values
int|null

getPaymentRegions()

public getPaymentRegions() : array<int, object>
Return values
array<int, object>

setCurr()

public setCurr(int|string|null $curr) : self
Parameters
$curr : int|string|null
Return values
self

setCurrencies()

public setCurrencies(array<string|int, object> $currencies) : self
Parameters
$currencies : array<string|int, object>
Return values
self

setCurrency()

public setCurrency(object|null $currency) : self
Parameters
$currency : object|null
Return values
self

setLocalizationPaymentRegion()

public setLocalizationPaymentRegion(object|null $paymentRegion) : self
Parameters
$paymentRegion : object|null
Return values
self

setPageCurrency()

Sets the currency the page shows prices in (null reverts to the display region currency).

public setPageCurrency(object|null $currency) : self
Parameters
$currency : object|null
Return values
self

setPaymentRegion()

public setPaymentRegion(object|null $paymentRegion) : self
Parameters
$paymentRegion : object|null
Return values
self

setPaymentRegions()

public setPaymentRegions(array<int, object> $paymentRegions) : self
Parameters
$paymentRegions : array<int, object>
Return values
self
On this page

Search results