CategoryPriceGridTrait
Axes of the category price list (Bazaar, Companies) in the shape of the tariff price list: the currency of a row per gateway and region, and the default VAT rate for the helper field "price with VAT".
IMPORTANT: the row currency must match the front end price lookup (PaymentFormItemDTO::getPrice(), by the currency of the region relation of the selected gateway): a credit gateway has credits, not the region currency. A price stored in the region currency is never found on the website for such gateways.
A category has no rate of its own: PaymentForm charges the 7/invoice.default.vatPercents
rate (PriceTrait::findTaxPercents()),
so the price list only displays it and has no select like the tariff one.
The Front payment gateway manager comes through #[Inject] (like TariffBillingFieldsTrait):
the Admin payment gateway does not map region relations, so only the map of id, shortcut and
monetary flag is read.
Table of Contents
Constants
- CATEGORY_FALLBACK_VAT_PERCENTS : mixed = 21
- Fallback rate when `7/invoice.default.vatPercents` is missing or not a number.
- CATEGORY_SETTING_MODULE_INVOICER : mixed = 7
- Module "invoicer" in the settings table (`cms_system_settings.module`).
Properties
- $categoryFrontPaymentGateManager : PaymentGateManager
- $categoryGateCurrencies : array<int, array<int, array{id: int, shortcut: string, monetary: bool}>>
Methods
- categoryPriceCurrencyId() : int|null
- Returns the price list row currency: the gateway region relation currency, falling back to the region currency.
- getCategoryVatPercents() : string
- Returns the default VAT rate from setting `7/invoice.default.vatPercents` (stored as text) for display: without trailing zeros, with the admin language separator ("21", "5,5").
- loadCategoryGateCurrencies() : void
Constants
CATEGORY_FALLBACK_VAT_PERCENTS
Fallback rate when `7/invoice.default.vatPercents` is missing or not a number.
private
mixed
CATEGORY_FALLBACK_VAT_PERCENTS
= 21
CATEGORY_SETTING_MODULE_INVOICER
Module "invoicer" in the settings table (`cms_system_settings.module`).
private
mixed
CATEGORY_SETTING_MODULE_INVOICER
= 7
Properties
$categoryFrontPaymentGateManager
public
PaymentGateManager
$categoryFrontPaymentGateManager
Attributes
- #[Inject]
$categoryGateCurrencies
private
array<int, array<int, array{id: int, shortcut: string, monetary: bool}>>
$categoryGateCurrencies
= []
gateId to regionId to currency
Methods
categoryPriceCurrencyId()
Returns the price list row currency: the gateway region relation currency, falling back to the region currency.
private
categoryPriceCurrencyId(int $gateId, int $regionId, int|null $regionCurrencyId) : int|null
Parameters
- $gateId : int
- $regionId : int
- $regionCurrencyId : int|null
Return values
int|nullgetCategoryVatPercents()
Returns the default VAT rate from setting `7/invoice.default.vatPercents` (stored as text) for display: without trailing zeros, with the admin language separator ("21", "5,5").
private
getCategoryVatPercents() : string
Return values
stringloadCategoryGateCurrencies()
private
loadCategoryGateCurrencies() : void