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

Currency Update (Automatic)

Views: 82,431

Results 61 to 80 of 298
18 Nov 2008, 5:54 AM
#61
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Currency Update (Automatic)

Normally you should have some kind of access to server, such as cpanel, it should allow you to set up cron yourself.

Otherwise, there are websites out there offer free cronjobs, that can be a temporary solution before you find a better solution.

55usd is certainly a rip-off, maybe they just dodnt want to do it, so they just throw in a high price? :)

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

18 Nov 2008, 9:47 AM
#62
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

You could add "pseudo-cron" to your site. Though my recommendation would also be to switch to a host who lets yor properly control your environment.

Kuroi Web Design and Development | Twitter

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

19 Nov 2008, 5:34 AM
#63
p1drobert avatar

p1drobert

New Zenner

Join Date:
May 2007
Location:
Melbourne, Australia
Posts:
88
Plugin Contributions:
0

Re: Currency Update (Automatic)

Thanks Kuroi, and Drbyte.

I checked with my hosting company and they definitely don't allow me to set my own cron jobs. I checked my console and theres no provision for it.

My hosting company charges about $65 a year for hosting which is pretty good. I think I'd be worse of financially switching hosts. It would make more sense to pay the $55 and forget about it.

However I've had a look at the free cron jobs sites, and a quick look at psuedo-cron. The free cron jobs sites look pretty shifty, so I might give psuedo-cron ago. That looks very interesting, and would probably work best. I could set it up to run every time someone landed on my index page. I'll give it a try once I research it properly.

20 Nov 2008, 3:57 AM
#64
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Currency Update (Automatic)

I get the following error when i try and run the file manually. Anyone know why i might get this error.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/delights/public_html/store/currency_update.php on line 63
preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match); if (sizeof($match) > 0) { return $match[3]; } else { return false; } } function quote_xe_currency($to, $from = DEFAULT_CURRENCY) { $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); $match = array(); preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match); if (sizeof($match) > 0) { return $match[1]; } else { return false; } } ?>h[3]; } else { return false; } } // // Function for currency lookup at XE // function quote_xe_currency($to, $from = DEFAULT_CURRENCY) { $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to); $match = array(); preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match); if (sizeof($match) > 0) { return $match[1]; } else { return false; } } ?>

20 Nov 2008, 4:05 AM
#65
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Currency Update (Automatic)

Delights:

I get the following error when i try and run the file manually. Anyone know why i might get this error.

It seems it was a bad install, i re-loaded the file and it is working now.

20 Nov 2008, 10:24 AM
#66
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Currency Update (Automatic)

The file runs and all that, but it is still saying last update was a day ago, it should be saying today.

11 Dec 2008, 1:14 PM
#67
mtimber avatar

mtimber

New Zenner

Join Date:
May 2008
Posts:
58
Plugin Contributions:
0

Re: Currency Update (Automatic)

Could someone look at this please?

I have asked my host to set up a Cron Job on the above software.

It did not work, so I asked them to test it.

This was there reply:

Hi,

The problem lays with some pretty poor coding in the script. Firstly it used:

require_once($location.'includes/configure.php');
require_once($location.'includes/database_tables.php');

which caused the following error:

PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '../includes/configure.php' (include_path='.:/php/includes:/usr/share/php') in /var/www/html/currency_update_curled.php on line 26

and so I changed those lines to read:

require_once('includes/configure.php');
require_once('includes/database_tables.php');

and then it gave the following error:

PHP Notice: Use of undefined constant CURL_PROXY_REQUIRED - assumed 'CURL_PROXY_REQUIRED' in /var/www/html/currency_update_curled.php on line 124

We do not use a proxy for cURL.

I'm afraid we cannot help any more with this as it is clearly a problem with the script you are using.

Can anyone advise?

The server people are Terranetwork.

11 Dec 2008, 3:46 PM
#68
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

The first problem raised by your host isn't a problem with the PHP, that's fine, it's a problem with your web host not reading the installation instructions.

The second is, I suspect, because you have asked your host to install the version of the updater intended for servers that use a proxy for CURL, so some of the environment constants are missing.

I would recommend that you aks her to install the original version (i.e. the one in the "free software add-ons" area, which is inteneded for normal setups.

Kuroi Web Design and Development | Twitter

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

15 Dec 2008, 11:03 AM
#69
mtimber avatar

mtimber

New Zenner

Join Date:
May 2008
Posts:
58
Plugin Contributions:
0

Re: Currency Update (Automatic)

kuroi:

The first problem raised by your host isn't a problem with the PHP, that's fine, it's a problem with your web host not reading the installation instructions.

The second is, I suspect, because you have asked your host to install the version of the updater intended for servers that use a proxy for CURL, so some of the environment constants are missing.

I would recommend that you aks her to install the original version (i.e. the one in the "free software add-ons" area, which is inteneded for normal setups.

It was myself that installed the file :-)

I just asked them to set up the Cron Job, just to clarify.

I will have another go, I appreciate you taking the time to reply :-)

Mark

15 Dec 2008, 11:16 AM
#70
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

Respect to you for admitting that. I was surprised by your host's comments, as I have great respect for her technical competence, but I can see how if she's seeing only the errors when she tries to run the script, she might jump to the conclusions she drew.

I'd recommend using the version of the script that you can download from this site and ensuring that the location variable is set as per the installation instructions. Hopefully that will go smoothly for you, otherwise let us know.

I'm rather assuming that sterling's current performance makes this a bit of a priority!

Kuroi Web Design and Development | Twitter

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

15 Dec 2008, 12:03 PM
#71
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Currency Update (Automatic)

require_once($location.'includes/configure.php');

gave the error: Failed opening required '../includes/configure.php'

which, as you can see, has it looking for the script in the wrong place.

Fixing that error it was then looking for a cURL Proxy, which would be fine if this were a GoDaddy server, or any other company that provides cURL via a Proxy, but we don't. Each site has cURL installed.

There is another major problem with the script. It is trying to access the XE and OANDA currency exchanges, both of which changed their policies about 2 years ago to disallow outside connections to their database unless you have a licence, which costs around $2,500 a year. In reality this means that you will occasionally be lucky and be able to connect to their db, but at other times the connection will be blocked.

Vger

15 Dec 2008, 3:51 PM
#72
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

Vger:

require_once($location.'includes/configure.php');

gave the error: Failed opening required '../includes/configure.php'

which, as you can see, has it looking for the script in the wrong place....being why the installation instructions say to set the location to reflect the local installation.

Vger:

Fixing that error it was then looking for a cURL Proxy, which would be fine if this were a GoDaddy server, or any other company that provides cURL via a Proxy, but we don't. Each site has cURL installed.Which is why I recommended to your client that he use the original, non-CURL version.

Vger:

There is another major problem with the script. It is trying to access the XE and OANDA currency exchanges, both of which changed their policies about 2 years ago to disallow outside connections to their database unless you have a licence, which costs around $2,500 a year. In reality this means that you will occasionally be lucky and be able to connect to their db, but at other times the connection will be blockedWith which I agree - though the original script was released before these changes. It's also worth noting that the code in this mod is basically the core Zen Cart code for currency updates with slight amendments to recognize that it may be installed in a different place and executed in a slightly different way.

There are now sites offering proper APIs that obviate the need for screen scrapping. Unfortunately nobody has yet contributed a mod based on this approach. Are you offering ...?

Kuroi Web Design and Development | Twitter

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

15 Dec 2008, 4:58 PM
#73
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Currency Update (Automatic)

Unfortunately nobody has yet contributed a mod based on this approach. Are you offering ...?

I may have a few spare free minutes ....some time around the year 2020. And by that time I shall be well and truly retired.

Vger

16 Dec 2008, 11:38 AM
#74
mtimber avatar

mtimber

New Zenner

Join Date:
May 2008
Posts:
58
Plugin Contributions:
0

Re: Currency Update (Automatic)

The helpful staff at Terranetwork have resolved this for me.

Once I set up the correct package (not the curled version).

I installed it in /var/www/html for anyone else looking to install it.

I also wanted to ask, as the currency exchange sites are now charging for connection, is Zen Cart now accessing them illegally?

I would not want anything running on my website that could be viewed as piracy or breaking copyright.

Zen Cart is great by the way.

I have no knowledge of css or php but have a fully functioning ecommerce website...

Brilliant.

(hard work at times - but that is the learning curve - learning to read the manual is a steep curve at times...)

Mark :-)

16 Dec 2008, 2:03 PM
#75
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

mtimber:

I also wanted to ask, as the currency exchange sites are now charging for connection, is Zen Cart now accessing them illegally?Glad to hear that Zen Cart is going well for you. It is a steep learning curve but well worth the effort.

In response to you question. No Zen Cart isn't accessing these rates illegally, but it is now unwittingly (since the ground rules were changed after Zen Cart's code was written) encouraging you to access them in contravention of the site owners' terms of use. Vger is absolutely correct on this.

Accordingly, I've updated the mod to use the European Central Bank's daily reference rates instead. It's actually easier, quicker, less likely to fail and unlikely to fall foul of a change in screen layout (as it no longer uses screen scrapping), as well as being completely above board and legal.

Look out for version 3.0 being enabled here.

Kuroi Web Design and Development | Twitter

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

16 Dec 2008, 2:38 PM
#76
mtimber avatar

mtimber

New Zenner

Join Date:
May 2008
Posts:
58
Plugin Contributions:
0

Re: Currency Update (Automatic)

kuroi:

Glad to hear that Zen Cart is going well for you. It is a steep learning curve but well worth the effort.

In response to you question. No Zen Cart isn't accessing these rates illegally, but it is now unwittingly (since the ground rules were changed after Zen Cart's code was written) encouraging you to access them in contravention of the site owners' terms of use. Vger is absolutely correct on this.

Accordingly, I've updated the mod to use the European Central Bank's daily reference rates instead. It's actually easier, quicker, less likely to fail and unlikely to fall foul of a change in screen layout (as it no longer uses screen scrapping), as well as being completely above board and legal.

Look out for version 3.0 being enabled here.

When do you think this will be ready?

:-)

I do not like the idea of breaking someones terms of use :-(

17 Dec 2008, 11:47 AM
#77
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Location:
England
Posts:
733
Plugin Contributions:
0

Re: Currency Update (Automatic)

Hello Kuroi,

This is an excellent update. For one site on a PHP 4.0 system, it works whereas previous versions didn't. I just had one thing. I have pounds (GBP) set as default currency. I have it set as 1.000000 . Today it was set at 1.04. So the prices on the website changed. I wondered if I can exclude the Default currency from increasing with the cron updates of the update page?

Heathenmagic

17 Dec 2008, 12:16 PM
#78
kuroi avatar

kuroi

Totally Zenned

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

Re: Currency Update (Automatic)

@HeathenMagic

Eeek. That's a bug. Can't believe I missed it :blush: Guess I was too busy checking very precisely the other currencies in my test dB that I forgot the default!!

I'll submit a corrected version immediately, and until it's approved, here's the correction.

Change lines 58-61 from:

      $rate = $currencyArray[$currency['code']] / $currencyArray[DEFAULT_CURRENCY];
    }
    $updateSql = "UPDATE " . TABLE_CURRENCIES . "
                  SET value = '" . $rate * CURRENCY_UPLIFT_RATIO . "',

to:

      $rate = ($currencyArray[$currency['code']] / $currencyArray[DEFAULT_CURRENCY]) * CURRENCY_UPLIFT_RATIO;
    }
    $updateSql = "UPDATE " . TABLE_CURRENCIES . "
                  SET value = '" . $rate . "',

Kuroi Web Design and Development | Twitter

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

17 Dec 2008, 3:26 PM
#79
naturesartandgifts avatar

naturesartandgifts

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Currency Update (Automatic)

Any chance someone will come up with an updated version using CURL to access European Central Bank? My server has allow_url_fopen disabled for security purposes. Thank you all.