- Theme Engine
- Design Principles
- Global variables
- Page templates
- Category templates
- Product templates
- EVML Reference
- Statements and Declarations
- Built-in Functions
- Built-in Objects
- EV Tags
- CSS Pre-processor
- Ajax API
It makes the World go round and so we've dedicated a complete object in its honour with some pretty funky methods to help you with multi-currency theme requirements.
The money object is found throughout Evance, as you would expect with an ecommerce platform. Product prices and cart values are automatically cast as Money objects, but you can instantiate a Money object yourself:
// creating a new Money object var gbp = new Money(1); // use the current locale's currency var usd = new Money(1, 'USD'); // explicitly set the currency // from a number var num = 1.toMoney();
The decimal value.
Type String (optional)
The currency of your Money object. When omitted the default currency for the current locale is used.
The left symbol for the currency.
The right symbol for the currency.
Convert to a new Currency and adjust the value using Evance's internal exchange rate. The new Money object will adopt the correct formatting for the new isoCode Currency.
Get or set the current Currency of the Money object. Returns a Currency object is no isoCode parameter is provided. Or, changes the current currency to a new isoCode Currency without adjusting the value. The formatting of the current Money object will alter to the new Currency format. This method returns the existing Money object allowing you to chain methods.
Returns the decimal value as a new String to preserve decimal places. If precision is not supplied the number of decimal places defaults to the number of decimal places for the currency.
|format([Number:precision [, String:decimal [, String:thousands]]])||
Allows you to output the Money value in a format of your choice. However, unlike the Number object the default values for precision, decimal and thousands are that of the Currency object and as such all are optional. The format method is also the toString method and therefore only needs to used if you wish to alter the format of the Money when outputting it.
Returns a new Number representing the decimal value of the Money.
Returns a new String representation of Money using all default values for the Money.format() method.