By In Magento

Fixing currency rates in Magento 1.x

While Magento 1.x is slowly fading into history, still there are lot of stores that still use it and therefore need to be maintained on regular bases.

If you have multi currency store, than you are familiar with built-in service Webservicex, which was responsible to update currency rates. Webservicex service stopped working a year ago and to make things even worst it will return 1 for all currency rates. That can cause lot of issues, for example it will allow customers to order items with price of base currency but without conversion.

As alternative many stores switched to ‘Payserv GoogleFinance’ module, which use Google Finance API to retrieve currency rates. Module was free to use and can be found on GitHub (thanks Magento for removing old marketplace – thumb down):

https://github.com/ausger/GoogleCurrency

Recently I noticed that a notice in Magento admin:

WARNING: Cannot retrieve rate from http://www.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}

Message came from ‘Payserv GoogleFinance’ module and was outputted when module tries to update currency rates. This happen because Google Finance changed URL for API service that should return rates. To make module functional small modification is needed and we will make it in Model file:

app/code/local/Payserv/GoogleFinance/Model/Google.php

at line #32 we will replace existing code with this one:

protected $_url = ‘https://finance.google.com/finance/converter?a=1&from={{CURRENCY_FROM}}&to={{CURRENCY_TO}}’;

As you may notice, comparing URL from notice and new URL that we set everything is same except domain name so now it is: https://finance.google.com/finance/

After you made change in file and upload it back, please try to import rates to be sure that module works now properly. As additional check you may open a Google Finance in browser and compare rates, for example USD to EUR: https://finance.google.com/finance/converter?a=1&from=USD&to=EUR

If you have issues to make this small change you can contact me and I can send you version of module with fix applied:
http://magehelperblog.com/contact-me/

 

Leave a Reply

Your email address will not be published. Required fields are marked *