Execute the file manually (i.e. by navigating to it in a browser) and see if that updates the currencies. That will show whether it is the setup of the script itself, or the CRON job that is at fault.
Printable View
Execute the file manually (i.e. by navigating to it in a browser) and see if that updates the currencies. That will show whether it is the setup of the script itself, or the CRON job that is at fault.
:blush::blush::blush:
Quote:
Warning: require_once(PATH_TO_STORE_ROOTincludes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/b/i/g/bigstar/html/bigstarca/store/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required 'PATH_TO_STORE_ROOTincludes/configure.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/b/i/g/bigstar/html/bigstarca/store/currency_update.php on line 20
That indicates that either the file you're using is corrupt, or you have removed the definition of PATH_TO_STORE_ROOT.
Can you give me an example of what my "path to store root" should be?
The currency_update.php file is located in http://www.mydomain.com/store/
Thank you for pointing me in the right direction. I figured out where I forgot to put the store root in the PHP file. It should work now.
What do I CHMOD currency_update.php file to??
Can someone teach me how do i configure my cron and my file " currency_update" plz?
did you read my previous posts on how I did it in my server control panel?
yes, i'm receveiving thw following errors in my email:
<br />
<b>Warning</b>: file() [<a href='function.file'>function.file</a>]: URL file-access is disabled in the server configuration in <b>/home/(my username)/public_html/egt/zencart/currency_update.php</b> on line <b>37</b><br />
<br />
<b>Warning</b>: file(http://www.ecb.europa.eu/stats/eurof...xref-daily.xml) [<a href='function.file'>function.file</a>]: failed to open stream: no suitable wrapper could be found in <b>/home/(my username)/public_html/egt/zencart/currency_update.php</b> on line <b>37</b><br />
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/(my username)/public_html/egt/zencart/currency_update.php</b> on line <b>40</b><br />
Your errors suggest that your web host is blocking the php file() function, which this mod uses to read in the currency data.
You would need to either get your web host to unblock that function, or try the curled version of thsi mod instead (see post #85 above).
Well, i contacted them.. and they said the php files are permitted and they gave me the command to run in the cron
"php /home/hostname/public_html/filename"
I already did it.. and i did not have success
That's the error message coming from the PHP installation on your web host's server, not Zen Cart and not this mod.
However, I think that your webhost has misunderstoof the issue and thinks you're asking about file permissions rather than the blocking of the PHP file() function. This function is now blocked by default in some installations of PHP5. Your web hosts may not even be aware that they're doing it.
If their technical knowledge is such that they can't sort it out, then you will need to look at the curled version of the add-in instead.
Hey guys, just a last help :P
What messenge would i receive if the script runs ok?
ty
You won't receive a message. It's intended to run silently in the background updating currencies and once working, no news is good news.
:lamo:
Hi everyone Awesome scripts, i am with Bravenet and they wont run cron jobs service but they said something about triggering the script to make it work? I found http://www.cronjobs.org but i cant really make sense of it all.
If anyone could help me with my major delema it would be heaps appreciated
:frusty:
Hi Again, i am having trouble as im not to educated in php code. getting the Define line17 set out right
I have this /var/www/html/shop-adons/automated_currency_update_v3_1/currency_update.php
If anyone could help i have read the forum over a few times now.
Help would be awesome thaks in advance :mellow:
I hope this post is still running, It would be nice if someone spare a moment :blush:
this is from my host
Do you support crontab for scheduled tasks?
No, we don't currently support cron or any other type of task scheduling. We have had members ask for this, and we will try to implement the support in a future hosting version.
As a possible alternative for in the meantime, you could use a crontab service from a different company to 'trigger' your script hosted on Bravenet at predefined intervals.
I would pay to have this done If anyone?
Please help
:bigups:
Nice add-on! I used this on my local testing PC, it works fine and do update the exchange rate. But I found the value is much different from the result I got using the zen-cart built-in function. Who knows Why?:frusty:
Rather than paying somebody to do this for you (though it's really quite straightforward - just put the script in your site's root directory and ask the service to make a call to it once a day), I'd recommend spending your money on a host with a full range of services. You shouldn't need to pay somebody else to set up another paid service just because your web host doesn't offer a fairly basic facility.
The answer can be found earlier in this thread. The built in service was written prior to the service providers changing their terms of business to forbid the screen-scrapping of real-time data that was common at the time. Nowadays you have to buy the service if you want to use it this way.
As a result the current version of the mod uses a different source (official European Central Bank rates, updated once a day). Zen Cart 2.0 will also use this legitimate source.
hello,
when the script runs it keeps failing. I am with GoDaddy hosting service. Anybody here with similar issue?
much appreciate your help.
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 1: ?php: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 2: /*: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 3: //Currency: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 4: //developed: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 5: //donations: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 6: //via: No such file or directory
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 7: syntax error near unexpected token `('
/home/content/s/i/t/username/html/currency_update/currency_update.php: line 7: `//every little bit helps - why donate (http: //www.modyourzencart.com/free-of-charge/why-donate)'
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.............
It looks to me as though the first character of your file, a "<", may be missing. But you're also using a very old version of the addon. Both the curled and non-curled versions currently in use have a header that looks like this:I recommend going to the free software and addons section of this site and getting an up-to-date version.Quote:
<?php
/**
* Automatic Currency Update v3.0
* Originally by Richard Fink (masterblaster) based on Zen Cart manual currency update
* updated by Kuroi to include Zen Cart's currency uplift ratio
* further updated by Kuroi to use European Central Bank reference rates (adapted from ECB-supplied code)
*
Got one for you.
The mod itself works if I access it through a browser window, no trouble at all.
The problem is that the cron job can't open the file.
The email log I get says: Could not open input file: home/username/public_html/zencart/includes/currency_update.php
(Names changed to protect the guilty)
Temporarily stuck there until I can get it working properly.
Chmod is 777, its in the spot it should be obviously and it does actually work, but the cron job won't make it happen.
Any suggestions, or should I bounce this off the hosting service?
Thanks, I hope...
Got it working, very simple in the end (isn't it always?)
Just so anyone out there gets into the same predicament as your truly, here is how it works if you are using Currency Update 3.1 'curled' and happen to be using cpanel for your site's back end adjustments.
Go to 'cron jobs', select 'standard' (because it's the easiest way to go), enter an email address for the cronjob logs (not required, but useful to pin point problems, just set up an email address for it) and then type
"curl http://www.yoursite.com/locationofcurrencyupdatefile/currency_update.php"
Set a time for scheduling, as recommended here, once a day is sufficient.
Save the crontab and you are done.
Take care to leave the space between 'curl' and the full i.p address of where you have put the currency_update.php file. You can also leave the file itself as currency_update_curled.php and it shouldn't make any difference.
Make really sure that in the currency_update.php file your full paths are accurate, both for where the currency_update.php file is, where the store's root file is and the two files it needs access to. If you hit trouble, enter the FULL path for the two files, 'includes/configure.php' and 'includes/database_tables.php' like this...
// This describes the path from the location where you install this file to the root directory of your Zen Cart
// It is normally the only line that you will need to edit. See readme for guidance.
DEFINE('/home/username/public_html/whereyourfileis/','/home/username/public_html/zencart/');
/ Get Zen Cart configuration data
require_once('/home/username/public_html/zencart/includes/configure.php');
require_once('/home/username/public_html/zencart/includes/database_tables.php');
'Path' is just like the above, home/username/public_html/zencart/etc/etc.
Address is http://www.example.com/etc.php
A sucessful cronjob will return an email to you that looks something like this.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
An unsucessful one will give you something else, but going with the above method seems to be nearly bulletproof, if only because I have tried dozens of other ways to get it working, and this is the only way that did it.
I hope that helps someone out there who gets stuck, and I wonder why a know nothing like me had to find out how simple it was after persuing all other methods...
G'day,
I've just installed this mod and it seems to be working just fine.
My store is running an earlier version of Zen Cart that doesn't have the Currency Conversion Ratio value defined. Thus I changed the appropriate lines in currency_update.php to:
On my setup I receive an email when a Cron job runs.Code://get currency conversion ratio
// $currency_uplift_ratio = mysql_db_query(DB_DATABASE, "select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key='CURRENCY_UPLIFT_RATIO' LIMIT 1 ", $link);
// $currency_uplift_ratio = mysql_fetch_array($currency_uplift_ratio);
// define('CURRENCY_UPLIFT_RATIO', $currency_uplift_ratio[0]);
define('CURRENCY_UPLIFT_RATIO', 1.0000);
It would be nice if currency_update.php actually output the currency exchange values used to update the store table. Then I'd receive this information in the daily email. It would serve as a documentation record of what exchange values were in place at what given times in the store.
Cheers, Lloyd Borrett.
Struggled for a few hours read all the threads, but I still cant make it work a point in the right direction would be very appreciated..
Zen Version 138a with automated_currency_update_v3_1
The error report
Warning: require_once(home/www/adulttoys4u.com.au/shop/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required 'home/www/adulttoys4u.com.au/shop/includes/configure.php' (include_path='.:/usr/local/php5/lib/php') in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
What I did as the path (amongst numerous other combination's)
these are line 17-21
DEFINE('PATH_TO_STORE_ROOT','home/www/adulttoys4u.com.au/shop/');
// Get Zen Cart configuration data
require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
Thanks
It's all in the instructions....read them carefully
PATH_TO_STORE_ROOT
// This describes the path from the location where you install this file to the root directory of your Zen Cart
// It is normally the only line that you will need to edit. See readme for guidance.
The keyword here is from. Don't give the total path of the server to your store..give the path from where you install the file. I.E. if the file is in the root of your store then you only need '/'. If it is down one folder in say admin then you need '/admin/'. Leave everything else alone.
Additionally I doubt the total path includes your domain name. Linux server normally shorten this to only maximum 8 characters...at a guess yours might be 'adulttoy' not 'adulttoys4u.com.au'..but its irrelevant anyway.......as you don't need the total path....
Thanks for your help, I tried the following and still I am not there, I am sure the answer is simple and yet nothing for me....as I am still struggling..
------------------------------------------------------------------
Ok the file is currency_update.php it is now located in
www.adulttoys4u.com.au/shop/currency_update.php. Yet I cannot call it by the url either and get this error messege.
Warning: require_once(/shop/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required '/shop/includes/configure.php' (include_path='.:/usr/local/php5/lib/php') in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
------------------------------------------------------------------------
This is the line I amended as per your instructions
DEFINE('PATH_TO_STORE_ROOT','/shop/');
// Get Zen Cart configuration data
require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
--------------------------------------------------------------------------
The Host control panel gives an example which shows I have to set the cron job up ...like this
rn /home/www/adulttoys4u.com.au/shop/currency_update.php/*
Thanks again.
But if the root of zen is in 'shop' and currency update is in 'shop' then all you need is a slash. remember 'PATH_TO_STORE_ROOT' is where is zen's root (not necessarily your websites root.) relative to currency_update.php
for cron this sort of thing works for me:
php -q /home/www/adulttoys4u.com.au/shop/currency_update.php
Hi KES99
I do so appreciate your efforts, though nothing has still worked, I have tried everything you suggested..
--------------------------------------------------------------------------
DEFINE('PATH_TO_STORE_ROOT','shop/');
gave me this
Warning: require_once(shop/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required '/includes/configure.php' (include_path='.:/usr/local/php5/lib/php') in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
& this DEFINE('PATH_TO_STORE_ROOT','/');
gave me
Warning: require_once(/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required '/includes/configure.php' (include_path='.:/usr/local/php5/lib/php') in /home/www/adulttoys4u.com.au/shop/currency_update.php on line 20
--------------------------------------------------------------------------
Just to clarify the shop file that all other files are in used to be called catalogue from the original zen cart installs..it is sat there on its own it is not in home or www or public ...
I look fwd to your next suggestion..kind regards..
Err just a thought are the file permissions at all relevant in this issue.
Hi KES99
Yes I have renamed the catalogue to shop. The configure folder is where it supposed to be. (the original file structure)
/shop/includes/configure.php
write permissions are as suggested by security procedures for zen item number 3 set configure.php to read only 444
Do you suggest I create a folder called www and drop the shop into it?
Cheers
RR
chdir(dirname(__FILE__));
DEFINE('PATH_TO_STORE_ROOT', dirname(__FILE__) . '/');
Personally I wouldn't have renamed anything. Too many things can and often do go wrong when you change the location of an installed item such as zen. Best is to install it where you want it and leave it alone.
I also wouldn't make a www folder. If you're on a linux/apache system www is often part of your path from the servers root. Actually it is often a link to public_html (the real root of your domain). You might really confuse things in having 2 www's.
Permission of 444 is correct.
Please check your message box for a PM from me.
Try the other solution suggested here by a_berezin. Other than that I'm stumped unless you reply in the afirmitive to my PM.
Hi All,
I have now tried changing the original file DEFINE('PATH_TO_STORE_ROOT','shop/'); to what Andrew Berezin suggested as per below,
The result now is upon calling the url http://www.adulttoys4u.com.au/shop/currency_update.php that I get a complete blank page and no errors...at all....So is this what is supposed to happen? I am not sure as there was no confirmation of anything, I run it and then then I run it again from the CP and I got different exchange rates but only by a few cents I am thinking thats because it updated from OANDA in the CP and from here http://www.ecb.europa.eu when called by the url..
Sooo Does it mean that If I go ahead and set the next stage IE the cron job now the currencies will be auto updated...
Cheers
Nearly there, Thanks KES99 I did get your PM hold that thought I think we are happening...
The file outputs nothing. This is deliberate, since it's designed to be run quietly and automatically as a script, not as a web page. So there would be nowhere in normal operation for any output to go.
The way I test it personally, is to tweak the currency rates in the database and then run it in a browser as you have and look in the database to see if they're changed. Then change them again and setup a CRON job for a few seconds into the future and look to see if they've changed. If those work then I set the CRON job to daily shortly after the official update time and check the results the next day.
:clap: Yeahiii that's fixed it and it all works just fine, (thanks for the code Andrew Berezin, I tested it like you suggested Kuroi and thanks to Kes 99 for your efforts.
PS Kuroi what is the GMT of the official currency update time.
Thanks
Regards
RR
:(:(:(
I am so sad. This is a great bit of code, but for the longest time I was getting a "Division by Zero" error when it would run, and the site would set everything to zero (except for the default currency) when i tried to update. What was the problem?
Well, I finally figured it out. The problem is that I am in South Korea, and the default currency is Won.
The ECB doesn't include the Korean Won in it's XML datafeed - even though they have it right there on the website.
I spent SOOOOOOOOO long trying to get this to work. But I think I'm SOL unless the ECB changes it's data feed. In the meantime, I will try installing 2.0
:cry:
Wish me luck!
OK, still :(. Haha. My host is not being a lot of help.
When I execute the script from a browser, it works fine.
When I execute through cron -
/home6/blahblah/public_html/currency_update.php: line 1: ?php: No such file or directory
/home6/blahblah/public_html/currency_update.php: line 2: /1,: Permission denied
/home6/blahblah/public_html/currency_update.php: line 3: access-logs: command not found
/home6/blahblah/public_html/currency_update.php: line 4: syntax error near unexpected token `('
/home6/blahblah/public_html/currency_update.php: line 4: ` * Originally by Richard Fink (masterblaster) based on Zen Cart manual currency update'
Whatever could be the problem? It doesn't seem to be interpreting as PHP at all. Any advice is greatly appreciated...
Thank you,
Sasha
I'm not sophisticated enough to know why, but for some reason PHP had to be given the path to the PHP interpreter. Simply putting in:
#!/usr/local/bin/php -q
as the first line of the .php file cleared it right up :)
Hi, there
I have used this script in my crob job: /usr/bin/curl /***/***/public_html/includes/currency_update_curled.php
But the return in email is: curl: (3) <url> malformed
What's wrong and how to deal with?
Any help would be highly appreciated.
All the best,
Hi, there
After 2 support ticket with bluehost, I got it done.
They use '/ramdisk/bin/php5 /home/...' as you input into the command to perform in cron job standard area.
All the best,
Hello,
I am with Justhost and i can't seem to get this working properly? The cron command used is usr/bin/php followed by the location of the file. When i do a manual update the currencies update but then they stay the same and do not automatically update according to the schedule? I have executed the file through the web browser and it just comes up with a blank page and a message at the bottom saying 'done'. Is this normal? Also the cron logs show that the file is being executed at the times specified but the log contains no information about any errors? Has anybody got an idea of what's going wrong?:unsure:
THis doesn't seem to work for me either. THis is just the error message from visiting the link with my web browser
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 65
Warning: file(http://www.xe.net/ucc/convert.cgi?Am...rom=EUR&To=USD) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 65
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 67
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 54
Warning: file(http://www.oanda.com/convert/fxdaily...e&sel_list=EUR) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 54
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 56
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 65
Warning: file(http://www.xe.net/ucc/convert.cgi?Am...rom=EUR&To=GBP) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 65
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 67
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 54
Warning: file(http://www.oanda.com/convert/fxdaily...e&sel_list=EUR) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 54
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 56
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 65
Warning: file(http://www.xe.net/ucc/convert.cgi?Am...rom=EUR&To=CAD) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 65
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 67
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 54
Warning: file(http://www.oanda.com/convert/fxdaily...e&sel_list=EUR) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 54
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 56
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 65
Warning: file(http://www.xe.net/ucc/convert.cgi?Am...rom=EUR&To=AUD) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 65
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 67
Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/lowprice/public_html/currency_update.php on line 54
Warning: file(http://www.oanda.com/convert/fxdaily...e&sel_list=EUR) [function.file]: failed to open stream: no suitable wrapper could be found in /home/lowprice/public_html/currency_update.php on line 54
Warning: implode() [function.implode]: Invalid arguments passed in /home/lowprice/public_html/currency_update.php on line 56
Can anyone help me
My cron job looks like (got this from my hosting provider): /ramdisk/bin/php5 -q/home7/xaralamb/public_html/currency_update_curled.php
Then my currency_update_curled.php looks like:
// This describes the path from the location where you install this file to the root directory of your Zen Cart
// and is normally the only line that you will need to edit
$location = '/home7/xaralamb/public_html/'; // location of zen-cart install
// Define currency servers
define('CURRENCY_SERVER_PRIMARY', 'xe');
define('CURRENCY_SERVER_BACKUP', 'oanda');
// Get Zen Cart configuration data
require_once($location.'includes/configure.php');
require_once($location.'includes/database_tables.php');
AND now I get this error:
Cannot bind/listen socket - [2] No such file or directory.
Couldn't create FastCGI listen socket on port /public_html/currency_update_curled.php
I am having path problems, my currency_update.php is in the same directory as config.php all in the includes directory and I get this error mail message.
<br />
<b>Warning</b>: require_once(./includes/configure.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>/home7/xaralamb/public_html/includes/currency_update.php</b> on line <b>21</b><br />
<br />
<b>Fatal error</b>: require_once() [<a href='function.require'>function.require</a>]: Failed opening required './includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home7/xaralamb/public_html/includes/currency_update.php</b> on line <b>21</b><br />
Once the cron is running properly are the emails supposed to stop coming through? Before I was getting lots of error messages but now they have gone away entirely no emails at all... I can't tell if i have succeeded in finding the correct paths or if I have wrecked something alltogether.... this stuff is so fun sometimes!! Anyone have any insigt as to what to expect or how to check if all is well?
Your origonal problem appears to be that you gave the mod the path from the root of your server to the update file, rather than that from the file to the root of your Zen Cart. If you've stopped getting warning messages from your server, then that suggests that either the CRON job has been disabled, or the file is now being found.
Testing something that should happen silently in the background can be a little challenging, but simply checking the values of your currencies in the Admin ? Localization menu just before and just after it runs is usually enough. It's rare that exactly the same values come back, especially if you have several currencies enabled.
This is what I am getting now, I am not sure what the path in the currency_update.php is supposed to look like, I've tried everything but I must have something backwards.
How do i write the path from the currency_update.php file to the root of the zencart ?
I have even tried to put the currency_update.php in the includes directory with no luck. I do have the cron working , that's one good step.
<br />
<b>Warning</b>: require_once(includes/configure.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>/home7/xaralamb/public_html/includes/currency_update.php</b> on line <b>20</b><br />
<br />
<b>Fatal error</b>: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home7/xaralamb/public_html/includes/currency_update.php</b> on line <b>20</b><br />
Ah. I think I see the problem. The mod is designed to allow cron jobs to be run from outside the web space on your server. So it's looking for a path from the currency script down to the config file and then down to the database_tables file.
To locate the file where you have it, you could try changing these linesto thisQuote:
// Get Zen Cart configuration data
require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
Quote:
// Get Zen Cart configuration data
require_once('configure.php');
require_once('database_tables.php');
Thanks for the assistance, you are very helpful. I will try this.
Also what email response would i get if all is working well as I read there is no indication and I also read you do get an email message for successful crons?
I used info from post#127 - do you agree with that information as well?
Thanks from Charals in Canada!
There is no email confirmation built into the mod. Maybe your web host has something built into their CRON installation, but you'd have to ask them about that.
Post #127 looks broadly OK to me, but I haven't used that version of the mod or checked the post in detail.
I am using the download automated_currency_update_v3_1.
So far I have had no error messages. But am waiting for the currencies to change. I will give it a few days to see how it goes.
I will check with my hosting service if there are any successful confirmation emails with their CRON feature. I would rather not have any as to not fill up me email inbox.
I appreciate your help very much.
Charals
Hi All!
I want to set currency updation for my client, now i put my currency_update.php in directory. /var/www/dev01/shzaikhn/surarean/internationalgalleryexposure.com/cartfm/pub
and i give path like this.
DEFINE('PATH_TO_STORE_ROOT','pub/currency_update.php');
now my qustion is that, how i will call corn, how mail i will recieve , i dont know if these are working or not, if error are remove.
i just calling that currency_update.php file like.
and please told me, what is the process of its working, means how calling are done.
team-kh.awpdc.com/~shzaikhn/surarean/internationalgalleryexposure.com/cartfm/pub/currency_update.php
but it give me error like,
Warning: require_once(includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/dev01/shzaikhn/surarean/internationalgalleryexposure.com/cartfm/pub/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required 'includes/configure.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/dev01/shzaikhn/surarean/internationalgalleryexposure.com/cartfm/pub/currency_update.php on line 20
please help me, i am very confused what i do for this.
Any help would be realy appreciate,:smartalec:
Can anyone point me towards an example of this module actually working on a live Zen Cart site? I went through 5 pages of this long thread but didn't see a real example.
Thanks :)
I run it on any site operating with more than one currency, but there's nothing to see. It's all hidden away behind the scenes.
If your point is that the thread contains posts primarily with people having problems, well that's the nature of a support thread. People who install and run it without problem don't really have any reason to post here.
Thanks kuroi
Is there an option to change currency? e.g. if price is displayed by default in Ł, can the user change it to $?
This mod only updates currencies, it doesn't touch prices which are converted to the appropriate currency by Zen Cart core code.
Hi,
Got a question for those folks who might understand what's going on with the currency update addon I have that just stopped working...
The cronjob I had running the update automatically today returned a timeout error, and doing the same thing manually gets the same time out. I am using the EU site for updates.
The error I get is this...
Warning: file(http://www. e c b.europa.eu/stats/eurofxref/eurofxref-daily.xml) [function.file]: failed to open stream: Connection timed out in /home/mysite/public_html/currency_update.php on line 37
Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/currency_update.php on line 40
The .php file on the site has not changed (when compared to a known good file) , and it looks like the EU site is there and working and the mod has been working just fine for the past few months.
Any ideas why it's stopped working just now?
(And I just ran it again now, it's working again! I guess this means it's something that generally isn't noticed? Something not to worry about?)
Thanks, and I hope some good comes of this, even if what I had happening was nothing... :unsure:
to anyone having problems with the root directory install I had problems with this until I removed the . at the start of the directory address.
$location = '/home/[username]/public_html/'; // location of zen-cart intall
seemed to work fine after that.
Ok I'll post my setup to help people having problems. (Using justhost.com)
using standard cron through cpanel:
php -q /home/[username]/public_html/catalog/currency_update.php
php -q tells the cron to use the php intrepter or the cron will just try to run each line in the php file itself.
the php file has:
$location = '/home/[username]/public_html/catalog/'; // location of zen-cart intall
Although yours may not have the catalog folder. Make sure you include the '/' at the end and in this case I had to delete the '.' at the start.
The file persmission needs to be 644 although some cron jobs need 755? i think.
With this currency_update.php script I added an email function that tells you when the script has been run. I had concerns that a user can run the script to update currencies when rates suddenly drop in a certain currency and therefore purchasing the product for cheaper than you intended. Ok it's unlikely but never say never.
Anyway this addition emails you when its run and also the new rates. This also provides you with a backup of currency rates if you need to change them back.
add this:
now add the $newrates code to the orignal and also the email function so it looks like:Code:require_once($location.'includes/configure.php');
require_once($location.'includes/database_tables.php');
// no need to edit below this line
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$newrates=''; // add this here
dont forget to change the email address.Code:
$newrates = $newrates."\n".$currency['code']." ".$rate;
if ($rate) {mysql_db_query(DB_DATABASE, "update " . TABLE_CURRENCIES . " set value = '" . $rate . "', last_updated = now() where currencies_id = '" . $currency['currencies_id']. "'", $link);}
}
}
mysql_close($link);
//end lookup
$to = "[email protected]";
$subject = "Currency Update";
$thedate = getdate();
$thedate = $thedate['hours'].":".$thedate['minutes'].".".$thedate['seconds']." ".$thedate['mday']."/".$thedate['mon']."/".$thedate['year'];
$body = "mywebsite.com\n\ncurrency_update.php script has been run on ".$thedate."\nRate: ".$newrates;
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
Not sure if that will help you or not but it's helped me.
I have tried both versions and get similar results, the latest "currency_update_curled.php: Permission denied"
I have asked my host if they can fix it and basically they say no. Only if I set up my own php.ini and I really dont have the guts for all that.
QUOTE The issue here is that, for security reasons, we have remote url access through fuctions like file disabled. UNQUOTE
Are there any other options (apart from moving host) ???
rgds
Mick
Hi!
Is it possible to tell the script to fetch currencies the same way as the manual ZenCart update? (At least as backup)
As for now one of the currencies (isk) is coming out with 0,- and thats really bad business... :unsure:
Hi guys,
I keep on getting this message when it tries to do it's task
No input file specified.
Halloj.
Found that "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" are missing the value for isk. However, manual currency update from "xe" provide it.
-How should I change "Define currency file" to fetch from "xe" instead of "ecb"?
Or maby even better as an backup, same way manual curency update does?
Troll
Hi.
Since "ecb" doesent provide one of the currencies I'm interested in, (one of the worlds most instable that is) I assume it should'nt be to complicated to fetch currenciy from "oanda" and/or "xe" (or somewhere else) instead?
At least tell the update function NOT to set values to zero!
Could someone please be so kind and give a hint!?
Troll
Thanks for answering kuroi!
Yes I have read something about that legal pov. But the built in update (localization.php as I understand) uses oanda / xe, and seem to work just fine... What's the difference? I reckon admin tools has to be as legal as some add-on!?...
-Zen Cart v.1.3.8 btw.
Just havent got the knowledge to combine the two scripts, as it seem to be the most obvious solution?...
As I said, isk in particular should be updated often! Actually with that currency this is a do or don't question...
Also seem to be a glitch that the "old" currency doesen't sustain when not fed with new values!?...
The difference is that the admin script was written in 2006, before the terms of use were changed. Earlier versions of the mod were based on that code. Though of course, I couldn't possibly suggest that you try using them instead.
I'm afraid that I don't understand your last paragraph.
Ok. thank's. Sorry to be slow... :wacko:
Still don't understand the legal thingy though... -No one could be blamed for using old verions, I get that. But I don't understand that including an old script to a new version makes it legal?...
But then again, I don't catch much of all them laws anyway... :cool:
Now I have this other problem:
I can't upgrade the addon because of superstition and a bad knee..
Could you please guide me how to fix the convertion ratio issue?
Also tried to explain with rough English:
If the supplier -feeder- of currencies give no value for a certain currency, (today this is the case with ECB and ISK found here) then the currency should stay with the latest updated value, instead of update to a value of zero! Otherwhise all products are marked zero-price for that currency!
Thank's a lot!
Troll
FINALLY I got this up and running! :smile:
I have spent so many hours on this supposedly simple task!... So I thought I should post some SOLUTIONS to some of the issues I have struggled with. As always, answers are more or less obvious, and have been enlightened before…
With a possibility to be totally out sailing, this works for me (so far):
currency_update.php
The versions after 2006 are using “ecb” for feed. Earlier versions are using “oanda” and ”xe” as the manual update in your Admin.
The mod, consisting of a single file, could be placed anywhere, but has to be edited to work:
In the first line of script (about row 14-17) “DEFINE” You should set the path FROM the file to the root of your store.
E.g. If you put the file directly onto your store root, this should only be a slash “/”. If you put it in “includes” it should be “./” and so on. (Path upwards in hierarchy)
In the next two lines “require_once” I had to set the FULL path to the two files: “configure.php” and “database_tables.php”. On my server I have named my store root “shop”, and my path is roughly: “/home/t/troll/www/shop/includes/configure.php” and “/home/t/troll/www/shop/includes/database_tables.php”
Cron job
In your command shell write “crontab –l” to list your crontab, and “crontab –e” to edit it. To edit in “VI” use “i” to insert, and “Esc : w q” to write to file and quit VI.
Your crontab has to include the full path to your “currency_update.php” file.
In my case I also had to include full path to php command. My cron that runs for every 6’th hour look like this:
* 0-23/6 * * * /usr/local/bin/php /home/t/troll/www/shop/currency_update.php
(Beware of the space between the php command and the path to the currency_update.php file.)
The cron setup paremeters are:
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * * command to be executed
For example, to run a cron job once a day at midnight set up: 0 0 * * * /path/to/php /path/to/file.php
To test your cron job you could set the job for a short interval. E.g. Setting it: 0-59/2 * * * * /path….
Will run the job every second minute. It’s then easy to check if your currency rate changing just by changing the “Currency Conversion Ratio” in your “Admin > Configuration > My Store”, and wait for two minutes. (Assuming that one works as it should…)
If you set the parameters wrong in your crontab, it should output a message when you save.
If you for example have got the paths wrong, and the job is NOT working properly, it outputs a mail with the error. (Just write “mail” in your command shell.)
Btw. You can check what services your host provides by simply making an “info.php” file, and add the code: <? phpinfo(); ?> into it. Then just open the “info.php” file in your browser.)
Hope this could be of some help for somebody! :P
Troll :cool:
I am new to this and have not had any problems setting up anything else with zencart until now.
I am loosing my mind with this. I have been at it for hours just to make sure i have read all the posts and not missed something.
The error I am getting when I try to access the "currency_update_curled.php file" using my browser just to see if it works is:
Warning: require_once(/home/[username]/public_html/imnaughty.net/includes/cinfigure.php) [function.require-once]: failed to open stream: No suchfile or directory in /home/dirtysic/public_html/imnaughty.net/currency_update_curled.php on line 20
Fatal error:require_once() [function.require-once]: Failed opeding required '/home/dcm2hdf/public_html/imnaughty.net/includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dirtysic/public_html/imnaughty.net/currency_update_curled.php on line 20
I have tried every variation i can think of. The "currency_update_curled.php file" is in the root directory. I have setup the cron job to be:
curl imnaughty.net/currency_update.php
as mentioned in a post about curled (cpanel)
I am unsure about the [username] also, is it your zencart usename or your username to login to cpanel or your username to login to your hosting???
Sorry if this is silly but i truely have read all 18 pages and cannot figure it out.
If you read the part you posted it says No suchfile or directory and failed to open file.
You need to play around with the part of script which mentions location.
Depending on your webhost the method you use may differ. See previous posts here for suggestions others have used
Hi Whitt,
Thanks for your comment. I understand that the location is the problem but I just can not figure it out. I have tried sooo many variations and literally read every post in the now 19 pages but can not get the right location.
I think it has maybe to do with the username,
When it says [username] - what username does it mean?
i use curled version and
'/var/www/vhosts/mywebsite.com/httpdocs/'
Quote:
Re: Currency Update (Automatic)
--------------------------------------------------------------------------------
i use curled version and
'/var/www/vhosts/mywebsite.com/httpdocs/'
Thank you for being so patient and taking to to assist.
I am trying everything i can think of and will try what you have above. In your example what does the "var" represent and the "vhost"????
not sure if this helps but my domain name is in my hosting account as an addon domain although the "currency etc" file is in the root directory for that domain name which is also the root directory for the zen-cart
Also just to clarify, the cron job detail should not affect me at this point of just using my browser to test if the file work - correct?
correct you can use browser at this stage.
I am not sure what var or vhost mean. that was on my hosts home page FAQ support area.
I just put file in root directory and think that must be how the script sends me to the root.
Some hosts use or need a different format .
give it a try and change my website to yours
I got onto my hosting support and they have told me that it should read:
/home/dirtysic/public_html/imnaughty.net/
this is what i have put into the file:
DEFINE ('/home/dirtysic/public_html/imnaughty.net/')
//Get Zen Cart configuration data
require_once('/home/dirtysic/public_html/imnaughty.net/currency_update_curled.php/includes/configure.php');
('/home/dirtysic/public_html/imnaughty.net/currency_update_curled.php/includes/database_tables.php');
But it still comes up with this error:
Warning: define() expects at least 2 parameters, 1 given in /home/dirtysic/public_html/imnaughty.net/currency_update_curled.php on line 17
Warning: require_once(/home/dirtysic/public_html/imnaughty.net/currency_update_curled.php/includes/configure.php) [function.require-once]: failed to open stream: Not a directory in /home/dirtysic/public_html/imnaughty.net/currency_update_curled.php on line 20
Fatal error: require_once() [function.require]: Failed opening required '/home/dirtysic/public_html/imnaughty.net/currency_update_curled.php/includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dirtysic/public_html/imnaughty.net/currency_update_curled.php on line 20
I am loosing my mind - PLEASE HELP
what happens if you use?
'/home/dirtysic/public_html/'
remember if you are going to use browser when it works you will get a blank page.
still no good - tried a few more variations but still not working. I tried without imnaughty and others but i am sure it needs to have imnaughty.net as that is a subdomain/addon on my hosting account.
I am open for any other ideas? maybe I should try the other version that is not "curled"?
Also, I am not sure but I dont think it has anything to do with permissions as i have set it to 744 for now but can change it if anyone thinks that is it
Installed this mod today on both of my stores (in separate sub domains) and simply duplicated the file currency_update.php as store1_currency_update.php and store2_currency_update.php.
Set up cron jobs as below, tested in cPanel and browser and it worked immediately without a glitch.
Great mod, thank you indeed. Shame the ECB does not update the xml file more often, especially when the markets are volatile.
This cron job has been suggested previously
My host requiresQuote:
/usr/lib/php /home/username/public_html/path/currency_update.php
andQuote:
/usr/local/bin/php /home/YOUR_USER_NAME/public_html/store1_currency_update.php
In the above command please note the space BETWEEN /usr/local/bin/php AND /home/YOUR_USER_NAME/public_html/store2_currency_update.phpQuote:
/usr/local/bin/php /home/YOUR_USER_NAME/public_html/store2_currency_update.php
if you close that gap (ie no space) the whole thing falls over.
Frank
This command should also work on a Linux server (not tested on my server though):
or
depening where your file is locatedQuote:
I still cant get it - i am sure i have the correct information but I must be just mixing it up? Anyone have any other suggestions?
I am still stuck with this.
Currently I have the file like this:
DEFINE ('/')
//Get Zen Cart configuration data
require_once('/home/dirtysic/public_html/imnaughty.net/currency_update.php/includes/configure.php');
('/home/dirtysic/public_html/imnaughty.net/currency_update.php/includes/database_tables.php');
But it still comes up with this error:
Warning: define() expects at least 2 parameters, 1 given in /home/dirtysic/public_html/imnaughty.net/currency_update.php on line 17
Warning: require_once(home/dirtysic/public_html/imnaughty.net/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/dirtysic/public_html/imnaughty.net/currency_update.php on line 20
Fatal error: require_once() [function.require]: Failed opening required 'home/dirtysic/public_html/imnaughty.net/includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dirtysic/public_html/imnaughty.net/currency_update.php on line 20
:censored:
Can anyone see what is wrong? If there is someone who knows how this works, I will pay to get this sorted as It is really taking too much of my time.
We can't see your server paths from the outside, but my best guess would be that you should set the first line to
and set the next two back toPHP Code:
DEFINE('PATH_TO_STORE_ROOT','');
This is based on a reading of your warning and error messages that seem to suggest that you have placed the currency update file in your site's root folderPHP Code:
// Get Zen Cart configuration data
require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
:clap:
Kuroi - you a legend, or possibly the zen God. It looks like that worked. I just used the original file that i downloaded intially. It looks like it worked and now just waiting for the cron job to go through.
Can I ask one more thing?
now that the file is changed back to the original do i still need to make the changes to the code at the bottom? As mentioned in other posts such as #169:
$newrates = $newrates."\n".$currency['code']." ".$rate;
if ($rate) {mysql_db_query(DB_DATABASE, "update " . TABLE_CURRENCIES . " set value = '" . $rate . "', last_updated = now() where currencies_id = '" . $currency['currencies_id']. "'", $link);}
}
}
mysql_close($link);
//end lookup
$to = "[email protected]";
$subject = "Currency Update";
$thedate = getdate();
$thedate = $thedate['hours'].":".$thedate['minutes'].".".$thedate['seconds']." ".$thedate['mday']."/".$thedate['mon']."/".$thedate['year'];
$body = "mywebsite.com\n\ncurrency_update.php script has been run on ".$thedate."\nRate: ".$newrates;
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
OR does the standard file work?
Mal
Those changes aren't part of this mod as such. They are a notification for the store owner that a change has occurred in the case where somebody triggers it manually by browsing to the file (CRON can usually be set to send an email in cases where the changes occur as planned).
However, this is only relevant when the file has been installed below the web root (in your case public_html). The mod is designed such that the file can be placed outside the web root, in which case nobody without inside access to the server would be able to execute the script anyway.
Even with it installed below the web root, I don't really see any risk. While I don't like the idea of a visitor being able to trigger a script on your site, in this case it would simply mean that they've improved the accuracy of your rates slightly before you do it yourself - so no real downside, i.e. I wouldn't bother with these additions.
IT WORKED!
Thank you Kuroi, all I had to do is use the default file and not make any changes to it. I put in the CRON job and it works. Thank you. Kuroi - sent you a PM
Just set this up on my third store albeit on a different server to the other two and with newer version of cPanel.
At first I placed the file into various locations, used this command to no avail
then moved it to top level and used the commandQuote:
/usr/local/bin/php /home/MY_ACCOUNT/public_html/FOLDER/currency_update.php
Result: :clap::clap:
I'm using this mod.
I installed this months ago, and had a bit of trouble getting it work but I figured it out soon after.
Randomly, a couple of days ago, I'm getting an error in the cron email:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /nfs/c04/h02/blah/blahblah/data/currency_update.php on line 51
Any ideas?
Nothing changed to the code or anything... :(