Jack_mcs Posted December 16, 2008 Share Posted December 16, 2008 (edited) If your shop offers more than one currency, you need this contribution. With excahnge rates changing daily, at times, it is important to keep them up-to-date. Many, if not most, shop owners are not aware that this needs to be done. This contribution can be ran as a cron job or semi-automatically and will handle the updates for you. The existing Update Currencies contribution uses an external site that has changed their policy which means the updates may not always work. It also uses code that will prevent cron jobs from working on all servers. This contribution uses changed code and the same sites that oscommerce has always used so those problems should not occur. Jack Edited December 16, 2008 by Jack_mcs Biancoblu 1 Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
seb1188 Posted December 28, 2008 Share Posted December 28, 2008 (edited) If your shop offers more than one currency, you need this contribution. With excahnge rates changing daily, at times, it is important to keep them up-to-date. Many, if not most, shop owners are not aware that this needs to be done. This contribution can be ran as a cron job or semi-automatically and will handle the updates for you. The existing Update Currencies contribution uses an external site that has changed their policy which means the updates may not always work. It also uses code that will prevent cron jobs from working on all servers. This contribution uses changed code and the same sites that oscommerce has always used so those problems should not occur. Jack i've given it a shot, but there seems to e a problem. roughly 1 in 5 (but random) currencies do not update? Edited December 28, 2008 by seb1188 Quote osCommerce is GREAT. When it works... Link to comment Share on other sites More sharing options...
seb1188 Posted December 28, 2008 Share Posted December 28, 2008 i've given it a shot, but there seems to e a problem. roughly 1 in 5 (but random) currencies do not update? it's a problem with the servers. XE does not work at all anymore (they charge for it these days) and oanda seems to be giving in too. anyone know of any other servers that can be used? Quote osCommerce is GREAT. When it works... Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 28, 2008 Author Share Posted December 28, 2008 That was the reason I wrote it using those servers. My site upgrades all currencies every night without any failures but another that I installed this script into will upgrade some currencies on some tries and others at others. I can only guess that it is a busy server issue. All of the online services I checked are wanting subscriptions to be made. While some are free, even onanda, it makes setting up a contribution like this impossible. If anyone knows of a reliable, free site, please let me know and I will add it to the code. In the meantime, I suggest you use the email option in the script and monitor the updates. You may find that all of the currencies get updated - just not everytime. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
seb1188 Posted December 28, 2008 Share Posted December 28, 2008 (edited) That was the reason I wrote it using those servers. My site upgrades all currencies every night without any failures but another that I installed this script into will upgrade some currencies on some tries and others at others. I can only guess that it is a busy server issue. All of the online services I checked are wanting subscriptions to be made. While some are free, even onanda, it makes setting up a contribution like this impossible. If anyone knows of a reliable, free site, please let me know and I will add it to the code. In the meantime, I suggest you use the email option in the script and monitor the updates. You may find that all of the currencies get updated - just not everytime. Jack i've just set my cron to run every hour... with 24 tries per day it's bound to get them all right at some point in 24 hours!!!! although that's probably what caused this issue in the first place... too many sites updating too often. Edited December 28, 2008 by seb1188 Quote osCommerce is GREAT. When it works... Link to comment Share on other sites More sharing options...
seb1188 Posted December 28, 2008 Share Posted December 28, 2008 (edited) I've found a few feeds you might want to look into. I've also foun a free API that looks REALLY useful: http://xurrency.com/api Check it out: if it's accurate and reliable it'd be really simple to use. As for XML feeds: The first is the European Central Bank, so uses the EUR as base rate (simple calculation can convert this to whatever): http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml Another website, currencysource.com, seems quite useful, though they only allow you to check each currency once every 15 minutes and don't update it at weekends (though for the most part forex doesn't chnage at weekends, as its only Australia that really trades on our Sundays, and a few weirdos in Claifornia trading on Saturday mornings...): http://www.currencysource.com/rss_currencyexchangerates.html Don't know much about this one, just where it is, but it's especially useful as it doesn't use only one base rate: http://www.webservicex.net/CurrencyConvert...;ToCurrency=GBP obviously GBP and USD would be replaced with variables to get any currency you want... Bank of Canada (so CAD is only base rat available): http://www.bankofcanada.ca/en/rates/rss_fx.html Edited December 28, 2008 by seb1188 Quote osCommerce is GREAT. When it works... Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 29, 2008 Author Share Posted December 29, 2008 Thanks for the links. I'll test them out at some point. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
apilon45 Posted December 29, 2008 Share Posted December 29, 2008 If your shop offers more than one currency, you need this contribution. With excahnge rates changing daily, at times, it is important to keep them up-to-date. Many, if not most, shop owners are not aware that this needs to be done. This contribution can be ran as a cron job or semi-automatically and will handle the updates for you. The existing Update Currencies contribution uses an external site that has changed their policy which means the updates may not always work. It also uses code that will prevent cron jobs from working on all servers. This contribution uses changed code and the same sites that oscommerce has always used so those problems should not occur. Jack Good evening I installed your contribution and set up a cron job via cpanel and set the permission to 755 on the file and now this is what i am getting /home/digitalh/public_html/admin/auto_update_currencies.php: line 1: ?: No such file or directory /home/digitalh/public_html/admin/auto_update_currencies.php: line 2: /aquota.user: Permission denied /home/digitalh/public_html/admin/auto_update_currencies.php: line 3: Auto: command not found /home/digitalh/public_html/admin/auto_update_currencies.php: line 4: osCommerce,: command not found /home/digitalh/public_html/admin/auto_update_currencies.php: line 5: http://www.oscommerce.com: No such file or directory /home/digitalh/public_html/admin/auto_update_currencies.php: line 7: syntax error near unexpected token `c' /home/digitalh/public_html/admin/auto_update_currencies.php: line 7: ` Copyright © 2003 osCommerce' any help would be appreciated Alain Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 29, 2008 Author Share Posted December 29, 2008 That isn't a problem with the contribution. It is failing before it even loads the file. My guess is that either the file was corrupted when uploaded or your server is setup somehow to prevent it from working. If the script runs when ran manually, http://yoursite.com/admin/auto_update_currencies.php, then the problem is with cron and you will need to talk to your host. If it fails the same way, then try replacing the script. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
PLByrne Posted December 29, 2008 Share Posted December 29, 2008 Good evening I installed your contribution and set up a cron job via cpanel and set the permission to 755 on the file and now this is what i am getting /home/digitalh/public_html/admin/auto_update_currencies.php: line 1: ?: No such file or directory /home/digitalh/public_html/admin/auto_update_currencies.php: line 2: /aquota.user: Permission denied /home/digitalh/public_html/admin/auto_update_currencies.php: line 3: Auto: command not found /home/digitalh/public_html/admin/auto_update_currencies.php: line 4: osCommerce,: command not found /home/digitalh/public_html/admin/auto_update_currencies.php: line 5: http://www.oscommerce.com: No such file or directory /home/digitalh/public_html/admin/auto_update_currencies.php: line 7: syntax error near unexpected token `c' /home/digitalh/public_html/admin/auto_update_currencies.php: line 7: ` Copyright © 2003 osCommerce' any help would be appreciated Alain It looks like it isn't executing it as PHP... try entering this in the cron box: php /home/digitalh/public_html/admin/auto_update_currencies.php I'm guessing that you haven't got the php bit at the front Quote Link to comment Share on other sites More sharing options...
apilon45 Posted December 29, 2008 Share Posted December 29, 2008 It looks like it isn't executing it as PHP... try entering this in the cron box: php /home/digitalh/public_html/admin/auto_update_currencies.php I'm guessing that you haven't got the php bit at the front Thanks it solved the problem Quote Link to comment Share on other sites More sharing options...
TOG Posted January 5, 2009 Share Posted January 5, 2009 (edited) Hey Guys, I've done the installation and set the Cronjob but get the following result: /bin/sh: -c: line 0: syntax error near unexpected token `newline' /bin/sh: -c: line 0: `/home/httpd/cgi-bin/php4 <auto_update_currencies.php>' My ISP has given me the following info: 1. To run a PHP 4 script. use the following: "/home/httpd/cgi-bin/php4 <filename>" 2. To run a PHP 5 script. use the following: "/home/httpd/cgi-bin/php5 <filename>" 3. To run a bash script, use the following: "/bin/bash <filename>" This is the Cronjob command I used: /home/httpd/cgi-bin/php4 <auto_update_currencies.php> Can you help me with this error? (I'm not too clued-up, so be gentle please) Regards, Leon Edited January 5, 2009 by TOG Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 5, 2009 Author Share Posted January 5, 2009 You have to give it the path to the file. Go to admin->modules and the full path will be listed on the page. Copy that and change it so it ends in admin/auto_update_currencies.php. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
TOG Posted January 6, 2009 Share Posted January 6, 2009 You have to give it the path to the file. Go to admin->modules and the full path will be listed on the page. Copy that and change it so it ends in admin/auto_update_currencies.php. Jack Thanks Jack, (My domain is www.leon.co.za) I'm now trying this: /home/httpd/cgi-bin/php4/leon/catalog/admin/auto_update_currencies.php and getting this: /tmp/cron_run_command_leon.sh: line 3: /home/httpd/cgi-bin/php4/leon/catalog/admin/auto_update_currencies.php: Not a directory Or trying this: /home/httpd/cgi-bin/php4 <leon/catalog/admin/auto_update_currencies.php> I'm getting this: /tmp/cron_run_command_leon.sh: line 3: syntax error near unexpected token `newline' /tmp/cron_run_command_leon.sh: line 3: `/home/httpd/cgi-bin/php4 <leon/catalog/admin/auto_update_currencies.php>' Can't figure it out... Appretiating your help! Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 6, 2009 Author Share Posted January 6, 2009 (edited) The usual structure is "path to php" "space" "path to file" Your host told you the path to php: /home/httpd/cgi-bin/php4 so add a space after it and place the full path /home/httpd/cgi-bin/php4 /home/leon/catalog/admin/auto_update_currencies.php I don't know that the second part is correct. As mentioned, you have to get that from the admin section. If it isn't correct, then you need to ask your host. That's what they are there for. Jack Edited January 6, 2009 by Jack_mcs Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 8, 2009 Author Share Posted January 8, 2009 A new version has been uploaded. The following has been change: - Reversed order of servers being checked since xe.com seems to provide quicker updates. These are settable in the file so they can be switched back if desired. - Added date checked code so that the updates are not attempted if an update has already been done within a certain number of hours. That number is settable in the file. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
seb1188 Posted January 8, 2009 Share Posted January 8, 2009 A new version has been uploaded. The following has been change: - Reversed order of servers being checked since xe.com seems to provide quicker updates. These are settable in the file so they can be switched back if desired. - Added date checked code so that the updates are not attempted if an update has already been done within a certain number of hours. That number is settable in the file. Jack In this new version, is the date checked only set if the update was succesful (and not when the update runs, but doesn't work)? If so, great work, solves a lot of problems! Thanks. Quote osCommerce is GREAT. When it works... Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 8, 2009 Author Share Posted January 8, 2009 I'm not sure I understand your question but here is what it does. When the script is ran, it reads in the last update value from the database for each currency. If the last update is more than the time value option in the file, the outdated currecny is checked. If it is successfully updated, the database last update value is updated. Otherwise it is not changed so the next time the script is ran, that currecny will be checked again. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 8, 2009 Author Share Posted January 8, 2009 I just realized there is a slight mistake in the code. The line in the file that reads return $ndays; should be changed to return $nhours; Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
BlindingLight Posted January 10, 2009 Share Posted January 10, 2009 I just realized there is a slight mistake in the code. The line in the file that readsreturn $ndays; should be changed to return $nhours; Jack Maybe this is not related to this contribution but i have this problem -> Warning: file() [function.file]: URL file-access is disabled in the server configuration in /nfs/c03/h04/mnt/56589/domains/html/admin/includes/functions/localization.php on line 14 This what I see every time I click on update and this is the same problem i get from the cron job. Any idea? Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 10, 2009 Author Share Posted January 10, 2009 It's a server problem. You'll need to talk to your host to see if they will allow it. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
BlindingLight Posted January 10, 2009 Share Posted January 10, 2009 It's a server problem. You'll need to talk to your host to see if they will allow it. Jack Let's see what they say. Thanks! Ed Quote Link to comment Share on other sites More sharing options...
BlindingLight Posted January 10, 2009 Share Posted January 10, 2009 It's a server problem. You'll need to talk to your host to see if they will allow it. Jack Yes. You were right. My hosts says "The PHP parameter allow_url_fopen has been disabled in both our PHP4 and PHP5 environments" "If enabled, allow_url_fopen allows PHP's file functions to retrieve data from remote locations such as an FTP server or web site, and could lead to code injection vulnerabilities. Typically these code injection vulnerabilities occur from improper input filtering when passing user-provided data to PHP functions. Disabling this function will help considerably in stopping your site(s) from being compromised, as well as help thwart the unauthorized use of our servers for abusive or malicious purposes." I am still adding this info here in case some other people have the same problem. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 10, 2009 Author Share Posted January 10, 2009 If you go to admin->Localization->Currencies and click Update Currencies, does it work? Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
markhere Posted February 11, 2009 Share Posted February 11, 2009 Brilliant Contribution. Very easy to install and does what it says on the box. Thanks WWW.Anniedays.2ya.com :) :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.