Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Preferred currency

A user can select one of the active currencies as "preferred currency". The system will then use this currency for the user. This can be done by requesting "shop/preferredcurrency" in the URL, choosing the desired currency from drop-down list and clicking the "Set" button. There is an additional possibility to set preferred currency by requesting "shop/setpreferredcurrency/(currency)/NOK" in the URL (you should replace "NOK" with the desired currency code). You can either create links for different currencies on your site or add a special toolbar as described below.

If the preferred currency is not specified, the system will use the default value specified by the "PreferredCurrency" setting in the "[CurrencySettings]" section of the "settings/shop.ini" configuration file. It is strongly recommended that you specify one of the active currencies in this setting.

It is possible to display only price in preferred currency to your customers when they are viewing multi-price products (please refer to the "Templates for viewing multi-price products" section for more information). Note that if you do not specify one of the existing currencies in the "PreferredCurrency" INI setting, the system will display zero prices to the first-time visitors of your site.

Example

Let's say that you have two currencies: EUR, NOK and the "settings/shop.ini" configuration file (or an override configuration file) contains the following lines:

[CurrencySettings]
PreferredCurrency=USD

If a user visits your site for the first time, the system knows nothing about his preferred currency and thus it will try to use the default value. However, the "USD" currency is not defined in your webshop system so there are no prices in this currency. The system will display zero prices using the currency symbol taken from your locale settings.

Adding a toolbar for customers

You can add a possibility for site visitors to change their preferred currency "on-the-fly" using the "Preferred currency" toolbar. To do this, add the following line into the "[Toolbar_right]" section of the "settings/siteaccess/example/toolbar.ini.append.php" file where "example" is your siteaccess name:

Tool[]=preferred_currency

This setting instructs the system to display the toolbar which is determined by the "preferred_currency.tpl" template located in the "templates/toolbar/full" directory of the standard design.

Preferred currency for site administrators

A site administrator can choose the preferred currency by requesting "shop/preferredcurrency" in the URL, choosing the desired currency from drop-down list and clicking the "Set" button. This interface can also be accessed by clicking the "Webshop" tab and selecting the "Preferred currency" link on the left. The selected currency will be used for displaying prices in the products overview interface.

Svitlana Shatokhina (05/05/2006 12:56 pm)

Svitlana Shatokhina (06/05/2006 1:53 pm)


Comments

  • setpreferredcurrency function in shop module

    Access denied when trying change preffered currency by anonymous user (don't have access to shop module). There is no appropriate function in shop module to grant access to shop/setpreferredcurrency for user.
    Shop account handler - ezdefault.
    eZ 3.8.6