Package DE_EPAGES::Shop::API::Resource::Formatter
formatter class for shop-dependend REST resources.
Functions
bool
Returns a formatted boolean in json format
Syntax |
$Bool = $Formatter->bool($Value); |
Example |
$hStruct = { isAvaliabe => $Formatter->bool($IsAvailable) }; $Bool = $Formatter->bool( $x < $y ); |
Input |
|
Return |
|
locale
Returns the locale.
Syntax |
$Locale = $Formatter->locale; |
Return |
|
new
Create a new Formatter object for a given shop to provide some format methods.
Syntax |
$Formatter = DE_EPAGES::Shop::API::Resource::Formatter->new($Shop, $LocaleID); |
Example |
$Formatter = DE_EPAGES::Shop::API::Resource::Formatter->new($Object->getSite,'de_DE'); |
Input |
|
Return |
|
price
Returns a formatted price of amount and currency symbol as defined for the formatter locale
Syntax |
$hPrice = $Formatter->price($Amount, $CurrencyID, $TaxModel); |
Example |
$hPrice = $Formatter->price(27.25, 'EUR', undef); $hPrice = $Formatter->price(1, 'GBP', TAX_MODEL_GROSS); |
Input |
|
Return |
|
quantity
Returns a formatted qunatity in json format
Syntax |
$hQuantity = $Formatter->quantity($Amount); $hQuantity = $Formatter->quantity($Amount, $Unit); |
Example |
$hStruct = { quantity => $Formatter->quantity(1) } $hStruct = { quantity => $Formatter->quantity(1,$Unit) } |
Input |
|
Return |
|
shop
Returns the shop.
Syntax |
$Shop = $Formatter->shop; |
Return |
|
unit
Returns a formatted unit representation
Syntax |
$UnitName = $Formatter->unit($Unit); |
Example |
$hStruct = { unit => $Formatter->unit($Unit) } |
Input |
|
Return |
|