Hazel will not do real-time currency conversion, but she will read exchange rates you supply and give the shopper an idea of order totals in their native currency. These rates are contained in your hazel-cat/rules/currency.rules file, in a simple format. Here's an example, based on a standard catalog currency of United States Dollars ("USD").
USD:1.00000 @ United States Dollars EUR:1.01298 @ Euro GBP:0.621960 @ United Kingdom Pounds JPY:110.527 @ Japan Yen
The currency code is given first, separated from its exchange rate for your base currency by a colon. Finally, an at-sign signals a more descriptive name for the currency.
Hazel will not charge orders in multiple currencies, and all prices in your products file should be in your own native currency. For example, if you accept funds primarily in dollars, all of your PRICE fields should be in dollars. Hazel will internally use that currency ("usd") for totals, and as the base for the rates given in your currency.rules file.
To actual show a price in another currency in one of your Hazel-served pages, use the Hazel-Currency tag. For example, if you wanted to know how many Japanese Yen equal 1 unit of your base currency, you'd use the following tag.
<Hazel-Currency Type="jpy" Amount="1.00">
Hazel will look for a "jpy" line in your currency.rules file, apply the proper equation to the given amount, and replace the tag with the proper amount in Yen.
Another, more practical usage of the Hazel-Currency tag would use a CURRENCY field value previously entered by the shopper to display checkout prices in their preferred currency. Try this within a products loop:
<Hazel-Currency Type="%HZE_CURRENCY" Amount="%HZI_PRICE">
For each product ordered, it will show its price in their selected currency. It's a good idea to also show prices in your native currency, and to stress that the exchange rates used are for reference only and may not correspond with current real-world rates!
The currency loop allows you to loop over all currencies recorded in Hazel's currency.rules file. Within the loop, %HZM_WORD1 is replaced with the currency code, %HZM_WORD2 with the exchange rate, and %HZM_WORD3 the description.
Here's an example which could be used in conjunction with the passed CURRENCY field suggestion above.
<select name="currency"> <option value="">Please Select a Native Currency</option> <Hazel-Loop Type="Currency"> <option value="%HZM_WORD1">%HZM_WORD3 (%HZM_WORD2)</option> </Hazel-Loop> </select>
Hazel's currency support is a great way to make international customers feel at home. See ValueLand OnLine Hobby Mall for an excellent currency implementation!
HZML & HAM
CGI and You