You are now viewing the documentation of eZ Publish legacy (4.x series and the legacy "stack" in 5.x). For 5.x versions this documentation must be complemented with the latest, more current documentation available at confluence.ez.no. Happy learning!

Currency rates

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 2:20 pm)

Svitlana Shatokhina (10/05/2006 9:55 am)


Comments

There are no comments.