User Guide | Getting Currency Session Data

When the flexi cart library is first loaded, an array is automatically created that is setup to match the carts default settings, this data is then stored in the browsers session. All items and settings that are then later added and altered within the cart are updated to the carts session data.

The data within the carts session can then be accessed and in many cases, formatted and customised using the large range of functions that are available from the lite and standard libraries.

Get Currency Session Data

Currency Function Index | Currency Config | Get Currency Helper Data | Set Currency Session Data | Currency Admin Data
Get Currency Data from Session

currency_name() | currency_symbol() | exchange_rate()

Help with Session Data Functions

Show / Hide Help

Name: The name of the function (method).

Data Type: The data type that is expected by the function.

  • bool : Requires a boolean value of 'TRUE' or 'FALSE'.
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.
  • array : Requires an array.

Required: Defines whether the parameter requires a value to be submitted.

Default: Defines the default parameter value that is used if no other value is submitted.

currency_name()

Returns the currency name (Example USD, EURO, GBP, AUD) of either the current or internal currency.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Return Values

Failure:n/a

Success:string

Examples
Note: The returned example values below are displaying live data from the current cart session data.
currency_name(FALSE) What is the current currency used to display monetary values? GBP
currency_name(TRUE) What is the internal currency used to display monetary values? GBP

currency_symbol()

Returns the currency symbol (Example $, €, £) for the users current currency.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
currency_symbol(internal_value) Help
Name Data Type Required Default Description
internal_value bool No FALSE Defines whether to return the value of the carts internal currency instead of the users current currency.
Return Values

Failure:n/a

Success:string

Examples
Note: The returned example values below are displaying live data from the current cart session data.
currency_symbol(FALSE) What is the current currency symbol used to display monetary values? £
currency_symbol(TRUE) What is the internal currency symbol used to display monetary values? £

exchange_rate()

Returns the exchange rate of the users current currency in comparison to the sites internal currency.


Library and Requirements

Available via the lite, standard and admin libraries.

Does not require any database tables to be enabled.

Function Parameters
exchange_rate(decimals) Help
Name Data Type Required Default Description
decimals int No 4 Defines the number of decimals to return the value with.
Return Values

Failure:n/a

Success:int

Examples
Note: The returned example values below are displaying live data from the current cart session data.
exchange_rate(4) What is the exchange rate conversion between the current currency and the carts internal currency, to four decimals? 1.0000