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
$curr
private
int|string|null
$curr
$currencies
private
array<string|int, object>
$currencies
= []
$currency
private
object|null
$currency
= null
$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|nullgetCurrencies()
public
getCurrencies() : array<string|int, object>
Return values
array<string|int, object>getCurrency()
public
getCurrency() : object|null
Return values
object|nullgetLocalizationPaymentRegion()
Returns the localization region (ignoring the customer's choice in an order).
public
getLocalizationPaymentRegion() : object|null
Return values
object|nullgetPageCurrency()
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|nullgetPaymentRegion()
public
getPaymentRegion() : object|null
Return values
object|nullgetPaymentRegionId()
public
getPaymentRegionId() : int|null
Return values
int|nullgetPaymentRegions()
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
selfsetCurrencies()
public
setCurrencies(array<string|int, object> $currencies) : self
Parameters
- $currencies : array<string|int, object>
Return values
selfsetCurrency()
public
setCurrency(object|null $currency) : self
Parameters
- $currency : object|null
Return values
selfsetLocalizationPaymentRegion()
public
setLocalizationPaymentRegion(object|null $paymentRegion) : self
Parameters
- $paymentRegion : object|null
Return values
selfsetPageCurrency()
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
selfsetPaymentRegion()
public
setPaymentRegion(object|null $paymentRegion) : self
Parameters
- $paymentRegion : object|null
Return values
selfsetPaymentRegions()
public
setPaymentRegions(array<int, object> $paymentRegions) : self
Parameters
- $paymentRegions : array<int, object>