Jump to content
thirty bees forum

ECB - edit for new exchange rate provider


beetea

Recommended Posts

The ECB exchange rate module does not handle every currency, so I modified it for another XML feed found here: http://www.floatrates.com/daily/usd.xml

I've modified the ECB code like so:

Line 24:

const SERVICE_URL = 'http://www.floatrates.com/daily/usd.xml';

starting line 147:

$this->serviceCache['USD'] = 1.0;
foreach ($XML->xpath('//item') as $entry) {
    $this->serviceCache[(string) $entry->targetCurrency] =
        (float) $entry->exchangeRate;
}

Seems to work. There are other feeds at the same site for other base currencies, in which case you'd have to modify the SERVICE_URL and the base currency ['USD']

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...