.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
It is worth noting that unlike the Oanda and XE, the ECB based only publishes reference rates for a select set of currencies. If a user has a currency outside that set, the code sets the rate to 0 which can cause users some grief.
It is necessary to escape updating any currency that returns a null value and perhaps sending the site admin an email to inform of this issue.
Agreed. And I certainly wouldn't recommend use of this mod for currencies not reported by the ECB. There's a link in the readme file bundled with the mod so that people can check what the currently reported currencies are.
That said, companies with access to the relevant foreign exchange information know that it is valuable and are generally trying to offer it at a price.
The ECB list was way ahead of the others that I could find that could be legitimately used in this way for this purpose. But if anybody knows of better, or even different, please do tell. Zen Cart's code is designed to support multiple provides of this information, so more sources could be added to fill in the gaps.
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Kuroi
Thanks for the work done. I only posted this because I read DrBytes' post that the mod was being included in the upcoming release.
You are correct that the ECB seems to actually encourage web developers to use them legally and I can't think of any other legit source.
Perhaps you can edit the mod to escape null rates. Something like below.
Simply skipping such rates might be better than setting them to zero.Code:if ($rate != 0) { $updateSql = "UPDATE " . TABLE_CURRENCIES . " SET value = '" . $rate . "', last_updated = now() WHERE currencies_id = '" . $currency['currencies_id']. "'"; mysql_db_query(DB_DATABASE, $updateSql, $link); }
I have written a curled version of the 3.1 automatic currency update script.
automatic_currency_updates_3-1-curled.zip
What are the improvements of this new curled version v3.1 over the previous v2.0.1
Is it worth me replacing my current one?
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Well done...this was the only one that worked for me....curl (required on servers running PhpSuExec) and EU central bank.
How often to run your cron? Well not that often..once a day is enough... ecb.int/stats/exchange/eurofxref/html/index.en.html states: The reference rates are based on the regular daily concertation procedure between central banks within and outside the European System of Central Banks, which normally takes place at 2.15 p.m. CET.
Why run it more often if the rates only update once a day!!!!!
Time your CRON......work out the time difference between your server and CET (GMT+1 or +2 when daylight saving in effect) go backwards or forwards (depends on where your server is) from 2.15pm (14:15) and that's the time to set your cron...actually I'd add on a bit more just in case the bank is slow. Weekends!!! well EU banks aren't open so rates probably wouldn't change so your cron can be run weekdays only not everyday......
best wishes all.............