inra311 Posted June 5, 2018 Share Posted June 5, 2018 I cannot update the currencies in admin anymore (2.3.4.1 CE), with fixer When I go to http://api.fixer.io/ I get the impression something has changed there, you need an api key!? Anyone else who has this problem or even a solution? (I have not tried to get an api key yet, as I probably would not know how to integrate it in osc) As an alternative, I meanwhile edited admin/includes/application_top.php and admin/includes/functions/localization.php top as suggested here: This way currencies update with xe at least --> define('CURRENCY_SERVER_BACKUP', 'xe'); Link to comment Share on other sites More sharing options...
puddlec Posted June 5, 2018 Share Posted June 5, 2018 From the fixer.io GitHub account https://github.com/fixerAPI/fixer Quote Required Changes to Legacy Integrations (api.fixer.io) As of March 6th 2018, the legacy Fixer API (api.fixer.io) is deprecated and a completely re-engineered API is now accessible at https://data.fixer.io/api/ The core structure of the old API has remained unchanged, and you will only need to perform a few simple changes to your integration. 1. Get a Free Fixer Access Token Go to fixer.io and create an account. After signup, you will receive an access token immediately. If you plan on using less than 1000 requests per month, your account will be completely free. If you need more or want to use some of our new features, you’ll need to choose one of the paid options. 2. Replace API URL and add Access Key The new API comes with a new endpoint and now requires an access key in the GET URL. Please change your API URL from api.fixer.io to https://data.fixer.io/api and attach your newly generated access key to the URL as a GET parameter named „access_key“. Example If your old API Call was https://api.fixer.io/latest then your new integration should point to: https://data.fixer.io/api/latest?access_key=YOUR_ACCESS_KEY Phoenix support now at https://phoenixcart.org/forum/ App created for phoenixTinyMCE editor for admin Link to comment Share on other sites More sharing options...
♥raiwa Posted June 6, 2018 Share Posted June 6, 2018 I could fix it, here the code: admin/includes/functions/localization.php: within the quote_fixer_currency function: function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('http://data.fixer.io/api/latest?access_key=YOUR_ACCESS_KEY&base=' . $from . '&symbols=' . $to); 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...
inra311 Posted June 7, 2018 Author Share Posted June 7, 2018 I think I prefer the fix from the link above which makes the currency updates via xe. It seems to work very reliable so far. Although the fixer api key is free, you need to register there and even enter your credit card data while this is not required with xe. The two changes are: replace in admin/includes/functions/localization.php: $page = file('https://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); to $page = file('http://www.xe.com/currencyconverter/convert/?Amount=1&From=' . $from . '&To=' . $to); and in admin/includes/application_top.php : define('CURRENCY_SERVER_PRIMARY', 'fixer'); to define('CURRENCY_SERVER_PRIMARY', 'xe'); Link to comment Share on other sites More sharing options...
inra311 Posted June 8, 2018 Author Share Posted June 8, 2018 As said, yes... --> using xe ( with the fix in the URL as described above) Link to comment Share on other sites More sharing options...
greasemonkey Posted June 8, 2018 Share Posted June 8, 2018 On 6/7/2018 at 2:28 PM, wHiTeHaT said: Is there an alternative?Currently working on the bootstrapped admin.So a legit fix can be implemented before release. I've been using "https://free.currencyconverterapi.com/api/v5/convert?q={$from}_{$to}&compact=ultra"); Not sure it would be the right thing for your build... but it does work... however..... Link to comment Share on other sites More sharing options...
♥DAVID3733 Posted July 31, 2018 Share Posted July 31, 2018 On 6/7/2018 at 7:18 PM, inra311 said: I think I prefer the fix from the link above which makes the currency updates via xe. It seems to work very reliable so far. Although the fixer api key is free, you need to register there and even enter your credit card data while this is not required with xe. The two changes are: replace in admin/includes/functions/localization.php: $page = file('https://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); to $page = file('http://www.xe.com/currencyconverter/convert/?Amount=1&From=' . $from . '&To=' . $to); and in admin/includes/application_top.php : define('CURRENCY_SERVER_PRIMARY', 'fixer'); to define('CURRENCY_SERVER_PRIMARY', 'xe'); Works for me, 2.3.4BS Previously used fixer Thank you David Link to comment Share on other sites More sharing options...
♥DAVID3733 Posted August 27, 2018 Share Posted August 27, 2018 Hello I was using XE for a while but now that has stopped working I signed up for a free account on Fixer, but the base currency is fixed to EUR, as use GBP i cannot use it usless i upgrade to the basic account which is only £10 per month but many a mickle makes a muckle so i am now using $ch = curl_init('https://api.exchangeratesapi.io/latest?&base=' . $from . '&symbols=' . $to); from https://exchangeratesapi.io/ seems to work at the moment, to make it easier i have included the whole section below that would go in Admin/includes/functions/ localization.php (dont forget you have to select define('CURRENCY_SERVER_PRIMARY', 'fixer'); in admin/application_top.php) Not a coder just a store owner so make your own enquires as to whether this is suitable for you function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('https://api.exchangeratesapi.io/latest?&base=' . $from . '&symbols=' . $to); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); $currencies = json_decode($data, true); if (isset($currencies['rates'][$to])) { return $currencies['rates'][$to]; } else { return false; } } David Link to comment Share on other sites More sharing options...
mattsc Posted September 27, 2018 Share Posted September 27, 2018 On 8/27/2018 at 8:30 AM, DAVID3733 said: I signed up for a free account on Fixer, but the base currency is fixed to EUR, as use GBP i cannot use it usless i upgrade to the basic account which is only £10 per month but many a mickle makes a muckle so i am now using $ch = curl_init('https://api.exchangeratesapi.io/latest?&base=' . $from . '&symbols=' . $to); from https://exchangeratesapi.io/ Thanks DAVID3733, I had the same issue as my base currency is Thai Baht, so this fix ^^^ worked for me. I actually just created an additional quote function which I called quote_exapi_currency, and then changed the primary currency converter service in application top and the auto-update currencies to use the exapi function. function quote_exapi_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('https://api.exchangeratesapi.io/latest?&base=' . $from . '&symbols=' . $to); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); $currencies = json_decode($data, true); if (isset($currencies['rates'][$to])) { return $currencies['rates'][$to]; } else { return false; } } My currencies are updating again. Wo0t! Link to comment Share on other sites More sharing options...
dr_lucas Posted October 15, 2018 Share Posted October 15, 2018 @DAVID3733 Thanks for that link, now I finally have a working exchange rate server again after 2 months we didn't notice all fail (oanda, xe and fixer). We do still need a backup server, just in case this one fails and we won't notice again. Does anyone have any suggestions/alternatives, preferably that don't require registration. Thanks Did I help you? Click "Like" or "Thanks"! It's free of charge. :)My contributions:Total Configuration (newly updated 07/2018, for both osC 2.2 and 2.3.4.1 BS Frozen CE)User Tracking with Admin 1.0 (newly updated 07/2018)FedEx - Web Services v9, FAQ System , Who's Online Enhancement, Order Editor, MoneyBookers IPN, Ship in Cart (MS2), Admin Products Paging, Margin Report v1.00, 2Checkout INS / IPN (Instant Notification System) for MS2.2, Visitor Web Stats, Time Zone Offset - Adjust to match your location, Category Meta Tags Link to comment Share on other sites More sharing options...
alex121121 Posted June 12, 2019 Share Posted June 12, 2019 On 6/6/2018 at 12:31 PM, raiwa said: I could fix it, here the code: admin/includes/functions/localization.php: within the quote_fixer_currency function: function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('http://data.fixer.io/api/latest?access_key=YOUR_ACCESS_KEY&base=' . $from . '&symbols=' . $to); I signed up for new fixer.io account and copied my API code in "localization.php as such: function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('http://data.fixer.io/api/latest?access_key=740a5dw0cb3987ea949g91f3d054624&base=' . $from . '&symbols=' . $to); Both currencies that i have installed (EUR, USD) stay at 1.00000, even when i click "Update exchange rate" manually in admin/currencies. I keep getting this error: Error: The exchange rate for U.S. Dollar (USD) was not updated via fixer. Is it a valid currency code? The exchange rate for Euro (EUR) was updated successfully via fixer The green one is always the default one. Is there another file that needs to be edited maybe? Link to comment Share on other sites More sharing options...
♥raiwa Posted June 12, 2019 Share Posted June 12, 2019 Fixer works only with EUR base currency. Pleasae see this post: 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...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.