ibexa

Path

ez publish / technical manual / 4.x / features / multi-currency / currency rates


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

Currency rates

This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!

There are two types of currency rates:

  • Auto rates
  • Custom rates

Auto rates

Auto rates are retrieved via automatic update of the exchange rates from the external source. It is possible to get these rates from the website of the European Central Bank using the built-in "eZECB" handler or to extend the system by creating your own update handler. Please note that you should specify the desired handler in the "ExchangeRatesUpdateHandler" INI setting described in the "Exchange rates update handlers" section, otherwise the system will not be able to update auto rates.

An auto rate of the currency is nothing more than the amount of this currency that must be given up in order to obtain one unit of the base currency. The base currency is determined by the "BaseCurrency" INI setting described in the "Exchange rates update handlers" section. It is recommended (but not required) that you specify one of the existing currencies in this setting.

The website of the European Central Bank allows to get the currency exchange rates relative to EUR. If you use the "eZECB" handler and set for example USD as the base currency, the system will retrieve the exchange rates relative to EUR and then calculate the auto rates relative to USD. Please note that you will get an error if the exchange rate for USD was not retrieved.

Example

Let's say that the following rates relative to EUR are indicated on the website of the European Central Bank:

Currency

Rate

NOK

7.85620

USD

1.20940

UAH

not available

If you specify EUR as the base currency, the system will set the following auto rates:

Currency

Auto rate

EUR

1.00000

NOK

7.85620

USD

1.20940

UAH

N/A

If you do not specify the base currency, the result will be the same.

If you specify USD as the base currency, the system will calculate the auto rates relative to USD as shown in the following table:

Currency

Auto rate

EUR

0.82685 ( 1 / 1.20940 )

NOK

6.49594 ( 7.85620 / 1.20940 )

USD

1.00000

UAH

N/A

If you specify UAH as the base currency, the system will display the following error message: "Unable to calculate cross-rate for currency-pair EUR/UAH" when trying to update the auto rates. Since the exchange rate for UAH was not retrieved from the website of the European Central Bank, the system will not be able to calculate the rates relative to UAH.

Custom rates

You can specify a fixed custom rate for a currency so that this value will be used instead of the auto rate value (the auto rate will not be used and thus it will be displayed in gray color). Please note that the custom rates must be relative to the same base currency as the auto rates. If you have for example five currencies with auto rates relative to EUR and you wish to specify a custom rate for one of them, make sure this rate is also relative to EUR.

If you are going to specify custom rates for all your currencies without exception, you may use some other currency as the base one. It is recommended (but not required) that you use one of the existing currencies as the base currency.

Example

Let's say that you have four currencies: USD, EUR, NOK and UAH. You can consider USD as the base currency and specify the custom rates relative to this currency, for example:

  • 1 for USD
  • 0.84 for EUR
  • 6.52 for NOK
  • 5.05 for UAH

If you then remove the "USD" currency, the custom rates for EUR, NOK and UAH will not be changed.

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

Ricardo Correia (17/04/2013 3:04 pm)

Svitlana Shatokhina, Ricardo Correia


Comments

There are no comments.