ePages 7.26.0 - DE_EPAGES/Product/API/Resource/FromPriceFormatter.pm

Package DE_EPAGES::Product::API::Resource::FromPriceFormatter

override formatter class for shop-dependend REST resources. to provide VariationPriceFromText attribute in formatted prices

Base
DE_EPAGES::Shop::API::Resource::Formatter

Functions

fromPrice

fromPrice

Returns a formatted price of amount and currency symbol as defined for the formatter locale. The formatted price includes a shop-specifix prefix (attribute Shop.VariationPriceFromText).

Syntax
$hPrice = $Formatter->fromPrice($Amount, $CurrencyID, $TaxModel);
Example
$hPrice = $Formatter->fromPrice(27.25, 'EUR', undef);
$hPrice = $Formatter->fromPrice(1, 'GBP', TAX_MODEL_GROSS);
Input
$Amount (float)
amount value
$CurrencyID (string)
currency string i.e. 'EUR'
$TaxModel (integer)
TAX_MODEL_NET or TAX_MODEL_GROSS,
see DE_EPAGES::Shop::API::Constants
Return
$hPrice (ref.hash)
formated price for use in a JSON structure, hash keys are:
  • amount - price value - float
  • currency - currency id, e.g. 'USD' - string
  • formatted - formatted price according to the selected locale,
    including a shop-specific prefix, like "from".
    For example: "from $25.49".
  • taxType - tax included? GROSS/NET/NONE