rebelsheep Posted February 7, 2019 Share Posted February 7, 2019 I've just installed OSCommerce v2.3.4.1 CE (Frozen). In admin I added a currency (GBP) and set it to default. When I chose Update Exchange Rate I get errors: Warning: include_once(includes/languages/english/modules/currencies/MODULE_ADMIN_CURRENCIES_INSTALLED): failed to open stream: No such file or directory in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 71Warning: include_once(): Failed opening 'includes/languages/english/modules/currencies/MODULE_ADMIN_CURRENCIES_INSTALLED' for inclusion (include_path='.:/usr/lib/php7.1') in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 71Warning: include_once(includes/modules/currencies/MODULE_ADMIN_CURRENCIES_INSTALLED): failed to open stream: No such file or directory in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 72Warning: include_once(): Failed opening 'includes/modules/currencies/MODULE_ADMIN_CURRENCIES_INSTALLED' for inclusion (include_path='.:/usr/lib/php7.1') in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 72Warning: call_user_func() expects parameter 1 to be a valid callback, class 'MODULE_ADMIN_CURRENCIES_INSTALLED' not found in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 76Warning: Cannot modify header information - headers already sent by (output started at /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php:71) in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/includes/functions/general.php on line 38 ...under includes/languages/english/modules/ there is no 'currencies folder. Q1: Do I need to install a currencies / exchange rate under includes/languages/english/modules/? Q2: Where do I look for modules compatible with Frozen? Q3: Even though I installed an extra currency (there are 3 showing in admin Euro, Dollar and GBP) only dollars shows in the Front End and I can't see an icon / button to choose / switch between different currencies. ?? Q4: I installed OSCommerce to root, not in a catalog directory, is this a problem, will it cause problems further down the line?? Front end at: http://notebookrepair.rocks/index.php Thank you. Link to comment Share on other sites More sharing options...
burt Posted February 7, 2019 Share Posted February 7, 2019 In your Admin go: Modules > Update Currency Install one. Then update your currencies. Personally, I find "currencylayer" better than "fixer"...but you can give whichever one you like a go. Link to comment Share on other sites More sharing options...
rebelsheep Posted February 7, 2019 Author Share Posted February 7, 2019 Thanks burt, that's great. I've signed up to currencylayer for their free subscription and now have an API key. I installed currencylayer under Modules > Update Currency with the API key provided. ...so a step forward, however.. Now if I choose 'Update Exchange Rate' under Currencies, there is no error but a message at the top of the screen 'Subscription plan does not support the requested API Function'. Q1: It is ok if I have to upgrade the plan with currencylayer so that 'Upate Exchange Rate' works, that is fine - just a bit suprised that the free version doesn't at least allow a manual update of rate, otherwise what else is it for?? Or have I missed something? Q2: Still no option to change currencies in the front end, and still in dollars (even though GBP is set as default in admin)?? Link to comment Share on other sites More sharing options...
burt Posted February 7, 2019 Share Posted February 7, 2019 I think I just used CurrencyLayer without a problem. I'll check what subscription I'm on, just a moment. Link to comment Share on other sites More sharing options...
burt Posted February 7, 2019 Share Posted February 7, 2019 IIRC currencylayer "free" now only supports USD as the source currency. And it looks like Fixer has been incorporated into CurrencyLayer (or vice versa). The last time I used the subscription service, it all worked as intended but that was on a developer account, so I cannot say if it would work "today". It looks like I'll have to build another Currency Converter 😕 Link to comment Share on other sites More sharing options...
burt Posted February 7, 2019 Share Posted February 7, 2019 Please try: https://github.com/gburton/Responsive-osCommerce/commit/84bb3c43da53b60040521dcef47195db6f8df34a and report back your findings. Thanks Important note: only one currency converter should be installed, so turn off any others. Link to comment Share on other sites More sharing options...
rebelsheep Posted February 7, 2019 Author Share Posted February 7, 2019 So I have downloaded the above files (copied and pasted the contents in to editor and then saved them with same names - c_currencylayer.php, c_exchangeratesapi.php, c_fixer.php). But not sure if I am getting the whole file contents -eg. if I click on c_exchangeratesapi.php I only see 26 lines of code ending with // just english, performed directly in the module. It opens with <?php, but I can't see the closing ?> as I would expect. Are these just snippets of the files? Anyway uploaded them to /admin/includes/languages/english/modules/currencies and now all be broken in both in Modules > Update Currencies and Localization > Currencies > Update Exchange Rate. Update Exchange Rate now gives: Warning: include_once(includes/languages/english/modules/currencies/c_currencylayer.php;c_fixer.php): failed to open stream: No such file or directory in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 71Warning: include_once(): Failed opening 'includes/languages/english/modules/currencies/c_currencylayer.php;c_fixer.php' for inclusion (include_path='.:/usr/lib/php7.1') in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 71Warning: include_once(includes/modules/currencies/c_currencylayer.php;c_fixer.php): failed to open stream: No such file or directory in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 72Warning: include_once(): Failed opening 'includes/modules/currencies/c_currencylayer.php;c_fixer.php' for inclusion (include_path='.:/usr/lib/php7.1') in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 72Warning: call_user_func() expects parameter 1 to be a valid callback, class 'c_currencylayer.php;c_fixer' not found in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php on line 76Warning: Cannot modify header information - headers already sent by (output started at /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/currencies.php:71) in /homepages/21/d219854835/htdocs/domains/notebookrepair.rocks/admin/includes/functions/general.php on line 38 I'm not sure if I am using GitHub correctly - surely I'm not seeing all the code for the three files (as previously mentioned). Thank you for any help or advice. Link to comment Share on other sites More sharing options...
rebelsheep Posted February 7, 2019 Author Share Posted February 7, 2019 For c_exchangeratesapi.php all I see is: <?php /* Copyright (c) 2019, G Burton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ define('MODULE_ADMIN_CURRENCIES_EXCHANGERATESAPI_TITLE', 'Exchange Rates API'); define('MODULE_ADMIN_CURRENCIES_EXCHANGERATESAPI_DESCRIPTION', 'Update Currencies via the Exchange Rates API.<div class=\'secWarning\'>Uses https://exchangeratesapi.io/ as a data source.</div>'); // good define('MODULE_ADMIN_CURRENCIES_EXCHANGERATESAPI_CURRENCIES_UPDATED', 'The exchange rate for %s was updated successfully via the Exchange Rates API.'); // bad // no multi-lang capability for bad messages // just english, performed directly in the module ...which surely is only part of a file?? Link to comment Share on other sites More sharing options...
burt Posted February 7, 2019 Share Posted February 7, 2019 Make sure you have the language file in the language dir and the module file in the module dir. Files should have no ending ?> And you can have just one currency module installed at any one time... This experimental code might not be suitable for someone brand new to osC (sorry, I hate that word "newbie") - can someone else please try it as well ? It seems to work well from my end. Link to comment Share on other sites More sharing options...
rebelsheep Posted February 10, 2019 Author Share Posted February 10, 2019 Hi, thank you, that now works. I think I hadn't installed BOTH files - so now that I have, I can see Exchange Rates API in the choice of Currency Modules. Installed Exchange Rates API and now in Localization > Currencies, if I click 'Update Exchange Rates'', the exchange rates are now updated successfully. Great! Observation... if dollars are set as the default currency, 'Currency Layer' DOES work when you choose 'Update Exchange Rate' on the basic subscription - it doesn't work with other currencies as the default with the basic subscription. Q: Not sure how to the default currency 'changes' in the front end?? A fresh install of OSCommerce (frozen) dollars are the default in front end and in admin. When I set the default to, say £ GBP in admin, I didn't change in front.... erm except after installing your files, and I came to test the site (front end) several days later, it has switched to £s. But now testing the site if I set the default back to dollars in Admin, it stays as £s in front end. Confused. Rather than just setting the default in Admin, do I have to do something else for the correct currency ($ or £ eg.) to show in the front end shop?? Thank you. Link to comment Share on other sites More sharing options...
♥raiwa Posted February 10, 2019 Share Posted February 10, 2019 On 2/7/2019 at 8:07 PM, burt said: IIRC currencylayer "free" now only supports USD as the source currency. And it looks like Fixer has been incorporated into CurrencyLayer (or vice versa). The last time I used the subscription service, it all worked as intended but that was on a developer account, so I cannot say if it would work "today". It looks like I'll have to build another Currency Converter 😕 Fixer still works on live store with EUR base currency. Conversion to US$, GBP and CHF works flawless. 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 February 10, 2019 Share Posted February 10, 2019 16 minutes ago, raiwa said: Fixer still works on live store with EUR base currency. Conversion to US$, GBP and CHF works flawless. It didn't seem to want to work for me. Could you try the new converter module I made and report back please...TY. https://github.com/gburton/Responsive-osCommerce/pull/704 If good, I'll drop it into Core and it's then another option to choose from. 1 hour ago, rebelsheep said: Installed Exchange Rates API and now in Localization > Currencies, if I click 'Update Exchange Rates'', the exchange rates are now updated successfully. Great! TY. Link to comment Share on other sites More sharing options...
rebelsheep Posted February 10, 2019 Author Share Posted February 10, 2019 Ah, ok - default currency takes effect after I clear the browser cache. Link to comment Share on other sites More sharing options...
♥raiwa Posted February 10, 2019 Share Posted February 10, 2019 1 hour ago, burt said: It didn't seem to want to work for me. Could you try the new converter module I made and report back please...TY. https://github.com/gburton/Responsive-osCommerce/pull/704 If good, I'll drop it into Core and it's then another option to choose from. TY. Tested under Windows local XAMPP PHP 7.29: New module works fine. I checked fixer on latest EDGE currency module update and it doesn't work neither. Error: The current subscription plan does not support this API endpoint, you may need to upgrade your plan. Meanwhile on the live store which is an older EDGE from 2017 it works fine. The coding used there is the following in admin/includes/functions/ localization.php: function quote_fixer_currency($to, $from = DEFAULT_CURRENCY) { if ($to == $from) return 1; $ch = curl_init('http://data.fixer.io/api/latest?access_key=MY_HARDCODED_ACCESS_KEY_HERE&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; } } and in admin/currencies: case 'update': $server_used = CURRENCY_SERVER_PRIMARY; $currency_query = tep_db_query("select currencies_id, code, title from " . TABLE_CURRENCIES); while ($currency = tep_db_fetch_array($currency_query)) { $quote_function = 'quote_' . CURRENCY_SERVER_PRIMARY . '_currency'; $rate = $quote_function($currency['code']); if (empty($rate) && (tep_not_null(CURRENCY_SERVER_BACKUP))) { $messageStack->add_session(sprintf(WARNING_PRIMARY_SERVER_FAILED, CURRENCY_SERVER_PRIMARY, $currency['title'], $currency['code']), 'warning'); $quote_function = 'quote_' . CURRENCY_SERVER_BACKUP . '_currency'; $rate = $quote_function($currency['code']); $server_used = CURRENCY_SERVER_BACKUP; } if (tep_not_null($rate)) { tep_db_query("update " . TABLE_CURRENCIES . " set value = '" . $rate . "', last_updated = now() where currencies_id = '" . (int)$currency['currencies_id'] . "'"); $messageStack->add_session(sprintf(TEXT_INFO_CURRENCY_UPDATED, $currency['title'], $currency['code'], $server_used), 'success'); } else { $messageStack->add_session(sprintf(ERROR_CURRENCY_INVALID, $currency['title'], $currency['code'], $server_used), 'error'); } } tep_redirect(tep_href_link('currencies.php', 'page=' . $_GET['page'] . '&cID=' . $_GET['cID'])); break; and in admin/application_top.php: define('CURRENCY_SERVER_PRIMARY', 'fixer'); define('CURRENCY_SERVER_BACKUP', ''); EDIT: Same fixer API Key used in both cases. 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 February 10, 2019 Share Posted February 10, 2019 TY. Have done investigation and found following; Fixer (Free) Base currency MUST be EURhttps://fixer.io/documentation - "Exchange rates delivered by the Fixer API are by default relative to EUR." Fixer (paid) Base currency can be any supported. CurrencyLayer (Free) Base currency MUST be USDhttps://currencylayer.com/documentation#source_currency_switching CurrencyLayer (paid) Base currency can be any supported. ExchangeLayer (new coded, not yet in Core) Base currency can be any supported. Link to comment Share on other sites More sharing options...
burt Posted June 3, 2019 Share Posted June 3, 2019 CurrencyLayer just reduced their API hard limit on the Free version; Quote As you may have noticed, the currencylayer Free Plan was recently adjusted to offer 250 instead of 1,000 monthly API requests. We're writing to remind you that this new limit will be enforced on all accounts subscribed to the Free Plan. Please upgrade your account to the Basic Plan by July 1st, 2019 if your monthly usage exceeds 250 API requests To raise this limit and prevent potential service disruption, please make sure to upgrade your subscription to the Basic Plan using the button below: If using currencylayer and 250 calls to the API is not enough, pay for a subscription. Or Use the latest ecb module, which as of this moment does not have a rated limit on use => https://github.com/gburton/Responsive-osCommerce/blob/master/admin/includes/modules/currencies/c_ecb.php Link to comment Share on other sites More sharing options...
alex121121 Posted June 12, 2019 Share Posted June 12, 2019 On 2/7/2019 at 7:25 PM, burt said: In your Admin go: Modules > Update Currency Install one. I have the module "Update Currency" absolutely nowhere in my admin modules. Do i have to install one first? I'm using Frozen 2.3.4 BS I dont even have the map admin/includes/languages/english/modules/currencies Should i manually create one and then add c_exchangeratesapi.php into it? Would i then be able to find module called "Update Currency"? Link to comment Share on other sites More sharing options...
♥raiwa Posted June 12, 2019 Share Posted June 12, 2019 It has been included in EDGE at a later point after the FROZEN release. See: https://github.com/gburton/Responsive-osCommerce/commit/20dd3c7d643490d05e3efa5428aacaf4d11132c9 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...
alex121121 Posted June 12, 2019 Share Posted June 12, 2019 9 minutes ago, raiwa said: It has been included in EDGE at a later point after the FROZEN release. I dont have that map "Currencies" in admin/includes/languages/english/modules nor in admin/includes/modules/ Will it work if i simply create the map "Currencies" in those locations and add those php files "c_ecb.php" to those locations? Link to comment Share on other sites More sharing options...
♥raiwa Posted June 12, 2019 Share Posted June 12, 2019 Sorry, you have to apply also these previous updates: https://github.com/gburton/Responsive-osCommerce/commit/737363f01b1135cc42f2ae90577da7e2520df72b https://github.com/gburton/Responsive-osCommerce/commit/0e7f0879e56ca68b363232efcdc8ba079fb03f8a https://github.com/gburton/Responsive-osCommerce/commit/003c59b91239de501ee5482cb903e95de696b5ee 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...
alex121121 Posted June 12, 2019 Share Posted June 12, 2019 Awesome, it really works now. Thank you Rainer. Is there not a way to make it update automatically once a day or do i have to come and click it manually each day? Link to comment Share on other sites More sharing options...
♥raiwa Posted June 12, 2019 Share Posted June 12, 2019 Auto Update Currencies V 1.0 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...
alex121121 Posted June 12, 2019 Share Posted June 12, 2019 You're the best! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.