Forums / All Other Contributions/Addons / Currency Update (Automatic)

Currency Update (Automatic)

Views: 82,431

Results 141 to 160 of 298
21 Jun 2009, 12:52 PM
#141
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Currency Update (Automatic)

Hi All,

I have now tried changing the original file DEFINE('PATH_TO_STORE_ROOT','shop/'); to what Andrew Berezin suggested as per below,

a_berezin:

chdir(dirname(FILE));
DEFINE('PATH_TO_STORE_ROOT', dirname(FILE) . '/');

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...

21 Jun 2009, 12:58 PM
#142
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Currency Update (Automatic)

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.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

23 Jun 2009, 12:48 AM
#143
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Currency Update (Automatic)

: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

10 Jul 2009, 12:34 PM
#144
buddhaflow avatar

buddhaflow

New Zenner

Join Date:
Mar 2009
Posts:
41
Plugin Contributions:
0

Re: Currency Update (Automatic)

:(:(:(
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!

10 Jul 2009, 12:51 PM
#145
buddhaflow avatar

buddhaflow

New Zenner

Join Date:
Mar 2009
Posts:
41
Plugin Contributions:
0

Re: Currency Update (Automatic)

Sorry, I'm an idiot.

Living in Korea, you'd think I would know that the Won is KRW, not WON.

I got spoiled by Google currency converter allowing me to type WON.

Everything is working like a million bucks with 3.1!

:D:D:D

buddhaflow:

:(:(:(
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!

11 Jul 2009, 6:41 PM
#146
buddhaflow avatar

buddhaflow

New Zenner

Join Date:
Mar 2009
Posts:
41
Plugin Contributions:
0

Re: Currency Update (Automatic)

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

11 Jul 2009, 9:51 PM
#147
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Currency Update (Automatic)

buddhaflow:

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 directoryThat sounds as though the CROM job is losing the opening "<" that forms part of the opening <?php tag. Thiough I'm sorry but I have no idea why it might do that.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

12 Jul 2009, 6:33 AM
#148
buddhaflow avatar

buddhaflow

New Zenner

Join Date:
Mar 2009
Posts:
41
Plugin Contributions:
0

Re: Currency Update (Automatic)

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 :)

30 Jul 2009, 2:03 AM
#149
shoesbuyonline avatar

shoesbuyonline

New Zenner

Join Date:
May 2009
Posts:
78
Plugin Contributions:
0

Re: Currency Update (Automatic)

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,

30 Jul 2009, 10:56 AM
#150
shoesbuyonline avatar

shoesbuyonline

New Zenner

Join Date:
May 2009
Posts:
78
Plugin Contributions:
0

Re: Currency Update (Automatic)

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,

30 Jul 2009, 7:11 PM
#151
globalmemory avatar

globalmemory

New Zenner

Join Date:
Sep 2008
Posts:
64
Plugin Contributions:
0

Re: Currency Update (Automatic)

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:

Regards,

GM

1 Aug 2009, 11:44 AM
#152
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: Currency Update (Automatic)

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?Amount=1&From=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?value=1&redirected=1&exch=USD&format=CSV&dest=Get+Table&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?Amount=1&From=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?value=1&redirected=1&exch=GBP&format=CSV&dest=Get+Table&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?Amount=1&From=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?value=1&redirected=1&exch=CAD&format=CSV&dest=Get+Table&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?Amount=1&From=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?value=1&redirected=1&exch=AUD&format=CSV&dest=Get+Table&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

24 Aug 2009, 8:21 PM
#153
charals avatar

charals

New Zenner

Join Date:
Jun 2009
Posts:
28
Plugin Contributions:
0

Re: Currency Update (Automatic)

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

25 Aug 2009, 1:34 AM
#154
charals avatar

charals

New Zenner

Join Date:
Jun 2009
Posts:
28
Plugin Contributions:
0

Re: Currency Update (Automatic)

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 />

25 Aug 2009, 2:01 AM
#155
charals avatar

charals

New Zenner

Join Date:
Jun 2009
Posts:
28
Plugin Contributions:
0

Re: Currency Update (Automatic)

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?

25 Aug 2009, 8:49 AM
#156
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Currency Update (Automatic)

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.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

25 Aug 2009, 12:32 PM
#157
charals avatar

charals

New Zenner

Join Date:
Jun 2009
Posts:
28
Plugin Contributions:
0

Re: Currency Update (Automatic)

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 />
25 Aug 2009, 1:47 PM
#158
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Currency Update (Automatic)

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 lines> // Get Zen Cart configuration data

require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
to this
// Get Zen Cart configuration data
require_once('configure.php');
require_once('database_tables.php');

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

25 Aug 2009, 2:56 PM
#159
charals avatar

charals

New Zenner

Join Date:
Jun 2009
Posts:
28
Plugin Contributions:
0

Re: Currency Update (Automatic)

kuroi:

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.

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!

25 Aug 2009, 3:01 PM
#160
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Currency Update (Automatic)

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.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)