Philip79 Posted December 3, 2016 Share Posted December 3, 2016 It appears that Oanda has discontinued or changed the access to their currency rates as the program \admin\includes\functions\localization.php is erroring out with the URL previously that worked for years. Anyone with any information? This happened with XE in 2015. Thanks. Link to comment Share on other sites More sharing options...
stylesoft Posted December 5, 2016 Share Posted December 5, 2016 Similar problem here, as of this week, (december 2016) Oanda not updating no matter how many times I try - is this related? Link to comment Share on other sites More sharing options...
ozEworks Posted December 5, 2016 Share Posted December 5, 2016 I believe it is not just oanda as xe is also getting errors. Warning: file_get_contents(http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=USD&format=CSV&dest=Get+Table&sel_list=USD): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/XXXXXXXX/public_html/XXXXXXX/includes/functions/localization.php on line 14Warning: file_get_contents(http://www.xe.net/ucc/convert.cgi?Amount=1&From=USD&To=USD): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/XXXXXXXX/public_html/XXXXXXX/includes/functions/localization.php on line 25 Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Share Posted December 5, 2016 Same here, last correct update from 2nd of december About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ozEworks Posted December 5, 2016 Share Posted December 5, 2016 Is XE working for anyone? Oanda seems to have a new converter https://www.oanda.com/currency/converter/ but they do reference their old one here https://www.oanda.com/currency/classic-converter https://www.oanda.com/convert/fxdaily redirects to https://www.oanda.com/currency/converter/ I read some more. https://oanda.secure.force.com/AnswersSupport?urlName=Exchange-Rates-API-FAQ-s&language=en_US Looks like this is now a Paid Service via API http://developer.oanda.com/exchange-rates-api/ Link to comment Share on other sites More sharing options...
ozEworks Posted December 5, 2016 Share Posted December 5, 2016 XE URL seems to now be http://www.xe.com/currencyconverter/convert/?Amount=1&From=USD&To=EUR Link to comment Share on other sites More sharing options...
burt Posted December 5, 2016 Share Posted December 5, 2016 Please test and report back: https://github.com/gburton/Responsive-osCommerce/pull/463/commits/dbe473677f03f42bd605cbb5da5ec440cd6440af and https://github.com/gburton/Responsive-osCommerce/pull/463/commits/a0562af40d955e995d8b42e041c7394a4a64ee86 You must perform the change to tep_not_null as well as the Fixer updates. Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Share Posted December 5, 2016 @@burt, all good :thumbsup: About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
burt Posted December 8, 2016 Share Posted December 8, 2016 Thank you for testing @@raiwa - appreciated. Link to comment Share on other sites More sharing options...
barnton Posted December 8, 2016 Share Posted December 8, 2016 Please test and report back: https://github.com/gburton/Responsive-osCommerce/pull/463/commits/dbe473677f03f42bd605cbb5da5ec440cd6440af and https://github.com/gburton/Responsive-osCommerce/pull/463/commits/a0562af40d955e995d8b42e041c7394a4a64ee86 You must perform the change to tep_not_null as well as the Fixer updates. Thanks Gary. Your solution is working perfectly and is very much appreciated. Link to comment Share on other sites More sharing options...
greasemonkey Posted December 8, 2016 Share Posted December 8, 2016 Why not add the google currency API as a third option? May bring more stability to the feature. Link to comment Share on other sites More sharing options...
dofi Posted December 9, 2016 Share Posted December 9, 2016 I been having the same problem, no currencies updating. has anyone found a solution to this problem ? Im really new to oscom. I dont understand the above "solution" Link to comment Share on other sites More sharing options...
burt Posted December 9, 2016 Share Posted December 9, 2016 Thank you for testing @@barnton - appreciated.Do Google have a Currency API @@greasemonkey - I could not find one.If youcannot handle this change @@dofi, then click this link for commercial help - which would cost you a beer most likely. Link to comment Share on other sites More sharing options...
greasemonkey Posted December 9, 2016 Share Posted December 9, 2016 @@burt here is some sample code that includes the address to google's API. I use this in a cron job to update automatically. <code> <?php $from_currency = 'USD'; $to_currency = 'INR'; $amount = 1; $results = converCurrency($from_currency,$to_currency,$amount); $regularExpression = '#\<span class=bld\>(.+?)\<\/span\>#s'; preg_match($regularExpression, $results, $finalData); echo $finalData[0]; function converCurrency($from,$to,$amount){ $url = "http://www.google.com/finance/converter?a=$amount&from=$from&to=$to"; $request = curl_init(); $timeOut = 0; curl_setopt ($request, CURLOPT_URL, $url); curl_setopt ($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($request, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); curl_setopt ($request, CURLOPT_CONNECTTIMEOUT, $timeOut); $response = curl_exec($request); curl_close($request); return $response; } ?><\code> Link to comment Share on other sites More sharing options...
burt Posted December 9, 2016 Share Posted December 9, 2016 Oh gosh no. That relies on a regex to find bld class, which is a similar thing to the problems in the USPS (or maybe UPS) addon. That just brings so many problems to the table. Avoid, like the plague. I wonder why Google don't have a proper API for this? Link to comment Share on other sites More sharing options...
greasemonkey Posted December 9, 2016 Share Posted December 9, 2016 @@burt that is a little beyond me... lol... At the end of the day below is the address - I'm not 100% sure but I presume you can develop your own code to call it (the sample I provide was a super quick google search). There are many many more examples to call this address. https://www.google.com/finance/converter Link to comment Share on other sites More sharing options...
dofi Posted December 9, 2016 Share Posted December 9, 2016 Thanks @@greasemonkey & burt. I had more than a few beers trying to fix this problem so will be great if I can get it done for a few bucks rather than going mad. I will put up a ticket one of the next days as the problem is more annoying than urgent. I want to give the exchange rate option for my customers. Great forum here, im sure I will be bak . thanks. Link to comment Share on other sites More sharing options...
burt Posted December 9, 2016 Share Posted December 9, 2016 Pretty much that is not good for relying upon as it does not give the "answer" in a clear format @@greasemonkey It would take 10 minutes to knock up script to drop into admin to do it, but it would be so much better if Google allowed to append an output such as: http://www.google.com/finance/converter?a=1&from=USD&to=GBP&outout=json This would allow developers to write good code to get the result rather than this kludge; $regularExpression = '#\<span class=bld\>(.+?)\<\/span\>#s'; to get the answer.... Put more simply, if Google decided to change the output to (say): <span class="currency">12.34</span> the code as written would break. Which is similar to what happens each year in the U(S)PS module... Link to comment Share on other sites More sharing options...
frankl Posted December 9, 2016 Share Posted December 9, 2016 Another option is European Central Bank daily rates in xml format http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml osCommerce user since 2003! Link to comment Share on other sites More sharing options...
tgely Posted December 10, 2016 Share Posted December 10, 2016 Its a clearing localization problem. Hungarian Central Bank (MNB) is for me. There should be selectable currency info modules. osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
mr_absinthe Posted December 12, 2016 Share Posted December 12, 2016 @@burt It is now updating all currencies just fine apart from BTC: Error: The exchange rate for Bitcoin (BTC) was not updated via fixer. Is it a valid currency code? Absinthe Original Liquor Store Link to comment Share on other sites More sharing options...
burt Posted December 12, 2016 Share Posted December 12, 2016 @@frankl this fixr system gets rates from the ECB. It does take all 32 currencies... @@Gergely HUF is returned by ECB, no problem? 1 EUR = 314.45 HUF @@mr_absinthe BTC (aka XBT) is not (yet) a valid currency code per ISO4217...hence the ECB does not return a rate...you would need to update this manually from within admin. Link to comment Share on other sites More sharing options...
tgely Posted December 13, 2016 Share Posted December 13, 2016 @@burt In our country we should use MNB (Hungarian Central Bank) currency exchange rates between bank account clearing. ECB exchange rates gives only informal data. Secondary options to use own bank currencies exchange rates.There are a lot of cases depends on self bank or money markets and national accounting rules. One option is very bound. I dont mind I could use MNB for me :) osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store. Link to comment Share on other sites More sharing options...
BertilPalmqvist Posted December 19, 2016 Share Posted December 19, 2016 Hi, I tested the following changes for the standard version as suggested by G Burton for the responsive version of osCommerce 2.3.4, running on a Linux server with PHP Version 5.6.29, It worked! First delete the rows marked with a minus sign, then add the rows marked with the plus signs. Please remove the line numbers, minus signs and plus signs if any in the beginning of the rows. Edit the file admin/includes/application_top.php 54 require(DIR_WS_INCLUDES . 'database_tables.php'); 55 56 // Define how do we update currency exchange rates 57 - // Possible values are 'oanda' 'xe' or '' 58 - define('CURRENCY_SERVER_PRIMARY', 'oanda'); 59 - define('CURRENCY_SERVER_BACKUP', 'xe'); 57 +// Possible values are 'oanda' 'xe' 'fixer' or '' 58 +// fixer is the lastest added, more details at http://fixer.io 59 + define('CURRENCY_SERVER_PRIMARY', 'fixer'); 60 + define('CURRENCY_SERVER_BACKUP', ''); 61 // include the database functions 62 require(DIR_WS_FUNCTIONS . 'database.php'); 63 Edit the file admin/includes/functions/localization.php NOTE!!!: I made a mistake when I edited this file. I put the ?> marker at the end of the file, and that resulted in a blank screen at admin login, so don't add ?> at the end of this file! 37 return false; 38 } 39 } 40 - ?> 40 + 41 + function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { 42 + if ($to == $from) return 1; 43 + 44 + $ch = curl_init('http://api.fixer.io/latest?base='. $from . '&symbols=' . $to); 45 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 46 + $data = curl_exec($ch); 47 + curl_close($ch); 48 + 49 + $currencies = json_decode($data, true); 50 + 51 + if (isset($currencies['rates'][$to])) { 52 + return $currencies['rates'][$to]; 53 + } else { 54 + return false; 55 + } 56 + } 57 + tep_not_null Replace admin side tep_not_null with shop side function of the same name. This solves a show-stopping bug where values less than 1.0 are seen as null (admin side). Edit the file admin/includes/functions/general.php 326 return false; 327 } 328 } else { 329 - if ( (is_string($value) || is_int($value)) && ($value != '') && ($value != 'NULL') && (strlen(trim($value)) > 0)) { 329 + if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) { 330 return true; 331 } else { 332 return false; It worked like a charm, for most currencies but not for TWD Taiwan new dollar. Why is that? Another question: Is it time now to update to the responsive version of osCommerce? /Bertil Link to comment Share on other sites More sharing options...
stylesoft Posted January 2, 2017 Share Posted January 2, 2017 So as everyone knows this started december 2016, i've read the thread, i've updated the git changes proposed by gburton, and sure enough USD now updates, however none of the other currencies will update: Heres my error: The exchange rate for U.S. Dollar (USD) was updated successfully via fixer. Error: The exchange rate for Euro (EUR) was not updated via fixer. Is it a valid currency code? Error: The exchange rate for UK Pound (GBP) was not updated via fixer. Is it a valid currency code? Error: The exchange rate for NZ Dollar (NZD) was not updated via fixer. Is it a valid currency code? Error: The exchange rate for Australian Dollar (AUD) was not updated via fixer. Is it a valid currency code? Please help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.