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

Currency Update (Automatic)

Results 1 to 20 of 298
18 Jun 2006, 21:54
#1
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Posts:
528
Plugin Contributions:
0

Currency Update (Automatic)

This contribution was already posted by myself on the forums a long time ago, but it seems to be lost for the newer zenners not knowing about it.
Here is a link to this mod: Automatic Currency Update.

This script is designed to run via cronjob within certain interval you may/must set. Once done, the script will check oanda.com or xe.com server with the current conversion rate and update your store.

This is extremely useful, if you don't click on the update button every hour :wink2:

Installation is very easy - just drop in the file and set the directory path to your Zen-Cart setup, if this script is not running in your Zen-Cart's folder. After that, set up the cronjob.

This is one of the wonderful set it & forget it options that are quite useful to have!
21 Jun 2006, 18:52
#2
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hello! Can you tell me what I should put in when I'm doing the cron job and it asks for the Command to run? Also, should I be choosing the Standard or Advanced (Unix) mode when doing the cron job?

Thanks!
21 Jun 2006, 19:16
#3
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Posts:
528
Plugin Contributions:
0

Re: Currency Update (Automatic)

Standard or Advanced one is self explaining. If you were in expert in this (cronjob) area, then ofcourse you would be choosing the advancded one, but I guess you wouldn't be asking.

The command to run is just the complete file path to this update script. A real "advancded" command is like this
30 * * * * /full/path/to/cron/script/file.php
which runs every 30 mins. In the normal view, you are given the option to let the xpanle generator set up the complete command to run (additional to the file path).
21 Jun 2006, 19:45
#4
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Thank you! So I can use the Standard mode and just put http://www.mysite.com/currency_update.php or wherever my script is located?
21 Jun 2006, 21:15
#5
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hmmm it's not working. It sends an e-mail each times it runs and says this: /bin/sh: line 1: http://www.babyplanet.ca/currency_update.php: No such file or directory

But the file is there...
22 Jun 2006, 09:26
#6
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Posts:
528
Plugin Contributions:
0

Re: Currency Update (Automatic)

You will have to use the exact system file path to this file. You shouldn't be using the web location in your cron.

It should be something like this
/var/www/~user123/html/file.php
22 Jun 2006, 17:20
#7
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hmmm OK, I did that, then it said permission was denied, oops! So I set the permissions to 777. Now the e-mail that comes says this:

/home/dburgi2/public_html/currency_update.php: line 1: ?php: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 2: /*: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 3: //Currency: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 4: //developed: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 5: //donations: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 6: //via: No such file or directory
/home/dburgi2/public_html/currency_update.php: line 7: syntax error near unexpected token `('
/home/dburgi2/public_html/currency_update.php: line 7: `//every little bit helps - why donate (http://www.modyourzencart.com/free-of-charge/why-donate)'

And the currencies aren't updating.
27 Jun 2006, 06:30
#8
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Does anyone have this working successfully who would like to share how they did it :D

Thanks!!!
27 Jun 2006, 06:43
#9
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Posts:
3,644
Plugin Contributions:
6

Re: Currency Update (Automatic)

You will need to talk to your host - it would seem that they do not allow the execution of php files via cron.

My server requires "nice -15 curl http://www...etc"

But this updater certainly works.
27 Jun 2006, 06:54
#10
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Oh OK, I'll ask them, thank you! Nice to know that maybe it's not just something I'm doing wrong :blush: I have seen tons of posts from others who seem to have it working fine, so I don't at all think it's a problem with the mod itself, I was just hoping someone here had a similar experience and still got it working!

So if it is my host, I will have to set it up differently somehow to make it work?
27 Jun 2006, 07:54
#11
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Posts:
3,644
Plugin Contributions:
6

Re: Currency Update (Automatic)

I think they will either have to make the changes - or tell you the correct command to use
28 Jun 2006, 07:07
#12
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Currency Update (Automatic)

Yep, you were right, thanks! I just had the cron job set up incorrectly. Works wonderfully now!
28 Jun 2006, 13:04
#13
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Posts:
528
Plugin Contributions:
0

Re: Currency Update (Automatic)

I am sorry I didn't see your questions before. Oh well at least you have it working now!
20 Dec 2006, 14:46
#14
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Posts:
263
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hi,

Today i install your module and it work fine,but i check rate of USD - VND and USD -GPB in xe.com and see it just 1 USD - 16020 VND and 1 USD - 0.50 GPB

When i click on update in admin ,the rate of high then in xe.com
1 USD - 17450 VND and 1 USD - 0.53 GPB

:cry: Can you tell me how to fix this?

KIMSON
23 Dec 2006, 13:54
#15
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: Currency Update (Automatic)

The difference is because the add-in module and Zen Cart work slightly differently.

The add-in module goes and gets the current mid-price for each currency and puts it in your database.

When you click on the update currency button to do a manual update, Zen Cart goes to the same places for the currencies but before putting them in your database, it applies a currency uplift factor to allow for the difference between the market mid-rate and the rate that you as a seller will actually get from your bank.

By default Zen Cart applies a 5% currency uplift equivalent to a whopping 10% currency spread. Unless you're working with an "exotic" currency, you will probably want to change this amount on the Admin > configuration > My Store page (near the bottom) to something more reasonable.

To apply the same uplift effect via the module would require some code changes.
24 Dec 2006, 00:19
#16
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: Currency Update (Automatic)

Hi Kimson.

As it's Christmas, I've updated the mod to take account of Zen Cart's currency conversion ratio and uploaded the new version to the Admin section of the downloads area. So that automated and manual currency updates now give the same results.
23 Feb 2007, 14:10
#17
kimsonvu avatar

kimsonvu

Zen Follower

Join Date:
Aug 2006
Posts:
263
Plugin Contributions:
0

Re: Currency Update (Automatic)

kuroi:

Hi Kimson.

As it's Christmas, I've updated the mod to take account of Zen Cart's currency conversion ratio and uploaded the new version to the Admin section of the downloads area. So that automated and manual currency updates now give the same results.


I see CPU quote over 20% when use this add-ons....
25 Feb 2007, 00:52
#18
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Posts:
10,475
Plugin Contributions:
9

Re: Currency Update (Automatic)

That's curious since it only has 44 lines of code and the only loop cycles only as many times as you have currencies. With what frequency are you running your CRON job?
27 Feb 2007, 12:43
#19
pi_xi avatar

pi_xi

New Zenner

Join Date:
Feb 2007
Posts:
4
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hello,

The problem might not always be with cron. Generally, if you run php from console, you should define where php resides on your system. Locate your php binary and add this to the first line of the currency_update.php:

#!/usr/bin/php

When the file (with +x rights) is run, it will tell the system to use the /usr/bin/php to interpret its contents.

The plugin works extremely well, big thanks to the author :-)
04 Jun 2007, 16:03
#20
cjjune avatar

cjjune

Zen Follower

Join Date:
Apr 2007
Posts:
139
Plugin Contributions:
0

Re: Currency Update (Automatic)

Danielle:

Yep, you were right, thanks! I just had the cron job set up incorrectly. Works wonderfully now!



:frusty:I get the exact same error as you. And my cron job command is
/home/emailname/public_html/currency_update.php

Is it correct? How did you get it right?

Hope to hear from anyone of you who knows.
Thank you