Welcome Guest, Not a member yet? Register   Sign In
Currency conversion on the fly
#1

[eluser]Andy UK[/eluser]
Can anyone tell me what the recommended method for doing currency conversion is? I would like my users to be able to select their preferred currency and have all the prices on the website show in that currency with the respective prefix.

Thanks!

Andy.
#2

[eluser]matt.asbury[/eluser]
Good post here using AJAX with jQuery and Google currency conversion API. If you didn't want to go down the javascript route, I'm sure it could be easily updated to a PHP/Codeignter version.

http://www.techmug.com/ajax-currency-con...oogle-api/
#3

[eluser]Andy UK[/eluser]
Thanks, the Google API is a good resource to have and the seems to support the Colombian Peso which is one of the ones I need.

Assuming I could setup a Cron job to update the rates in my database once a day, can anyone recommend a good table structure to store the rates? I currently have a Currency table that is something like this:

CURRENCIES TABLE
id - currency_code - currency_name - currency_symbol

So a currency id is assigned to the product as a base currency. Products can only have one base currency from which other currencies are calculated. The idea is that the user chooses their preferred currency for the view. If the product is in the currency they choose, then conversion is one to one, but if the base currency is different from the chosen view currency, then a conversion is applied.

I'm thinking of a second table that uses the currency table id as a foreign key, but I'm not certain on the best way to store the rates.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB