User Guide | Currency Configuration

flexi cart contains many features to aid the custom development of an e-commerce site.
In some instances, some of the features may be considered overkill, or may not require a database table to handle a feature.
In these cases, specific database tables can be disabled, or with some tables, specific columns can be disabled if not required.

In addition to this, the database tables and columns can be renamed to match the custom naming conventions.

Currency Configuration

Currency Function Index | Get Currency Session Data | Get Currency Helper Data | Set Currency Session Data | Currency Admin Data
Table and Config File Settings

Currency Table | Setting Defaults via Config File

Help with the Table Configuration

Show / Hide Help

Internal Name: The name that flexi cart internally references the table or column by.

Default Name: The default table or column name used in the actual table.

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

  • bool : Requires a boolean value set as either '0' (FALSE) or '1' (TRUE).
  • string : Requires a textual value.
  • int : Requires a numeric value. It does not matter whether the value is an integer, float, decimal etc.


Config File Location

The config file is located in CodeIgniters 'config' folder and is named 'flexi_cart.php'.

Currency Table

Contains currency data and an exchange rate that can be used to convert internal site prices to other currencies.


Table and Column Names
Help
Internal Name Default Name Data Type Description
table currency - The tables name.
id curr_id int The tables primary key.
name curr_name string The name of the currency.
exchange_rate curr_exchange_rate int The exchange rate between this currency and the carts internal currency.
symbol curr_symbol string The currency symbol that is either prefixed or suffixed to the currency when formatted.
symbol_suffix curr_symbol_suffix bool Defines whether to suffix the currency symbol to the currency when formatted.
thousand_separator curr_thousand_separator string The character used as the 'thousand' separator when formatting values over 1000.
For example the character ',' would format numbers as '1,000'.
decimal_separator curr_decimal_separator string The character used as the 'decimal' separator when formatting values.
For example the character '.' would format numbers as '1.00'.
status curr_status bool Defines the status of whether the currency is active or disabled.
Disabled records will not be used by flexi cart functions.
default curr_default int Defines the default currency to be applied to the cart when first loaded.
A table row defined as the default currency should be indicated with a value of 1.
This table column can be disabled.
Requirements

If the table is enabled, then with the exception of 'default', all other columns are required.

If the 'default' column is disabled, the cart will use the default currency settings defined via the config file.

The currency table is not related to any other tables.

Example
// Example #1 : Defining the table and column names.

$config['database']['currency']['table'] = 'currency';
$config['database']['currency']['columns']['id'] = 'curr_id';

// Defining the 'default' column.
$config['database']['currency']['default'] = 'curr_default';
// Example #2 : Disabling the table.

$config['database']['currency']['table'] = FALSE;

Defining Currency Defaults via the Config File.

A default currency settings can be set to correctly configure the cart when it is first loaded.

Setting default values via the config file is only necessary if the currency database table is not enabled.
If the currency table is enabled, the default currency settings can be defined by entering the value '1' into the row of the tables 'default' column.

Default currency settings set via the config file are only used if no default value has been set in the currency database table.


Default Settings
Parameter Name Data Type Description
name string Sets the name of the default currency.
symbol string Sets the currency symbol to be either prefixed or suffixed to formatted currency values.
symbol_suffix bool Defines whether to suffix the currency symbol to the end of the currency value.
This is typically used for Euro currency values.
thousand_separator string Sets the character used as the 'thousand' separator of numbers over 1000.
For example the character ',' would format numbers as '1,000'.
decimal_separator string Sets the character used as the 'decimal' separator for numbers.
For example the character '.' would format numbers as '1.00'.
Notes

It is a best practice to use HTML encoding for currency characters like the Pound and Euro. Example: £ = '£' / € = '€'.

To automatically include a space between the symbol and the value (e.g. '£ 9.99'), add ' ' after the symbol code (e.g. '£ ')

Example
// Example #1 : Defining default currency values set via the config file.

$config['defaults']['currency']['name'] = 'GBP';
$config['defaults']['currency']['symbol'] = '£';
$config['defaults']['currency']['symbol_suffix'] = FALSE;
$config['defaults']['currency']['thousand_separator'] = ',';
$config['defaults']['currency']['decimal_separator'] = '.';
// Example #2 : Disabling default currency values set via the config file.

$config['defaults']['currency']['name'] = FALSE;
$config['defaults']['currency']['symbol'] = FALSE;
$config['defaults']['currency']['symbol_suffix'] = FALSE;
$config['defaults']['currency']['thousand_separator'] = FALSE;
$config['defaults']['currency']['decimal_separator'] = FALSE;