Re: Currency Update (Automatic)
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
Quote:
/usr/lib/php /home/username/public_html/path/currency_update.php
My host requires
Quote:
/usr/local/bin/php /home/YOUR_USER_NAME/public_html/store1_currency_update.php
and
Quote:
/usr/local/bin/php /home/YOUR_USER_NAME/public_html/store2_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.php
if you close that gap (ie no space) the whole thing falls over.
Frank
Re: Currency Update (Automatic)
This command should also work on a Linux server (not tested on my server though):
or
depening where your file is located
Re: Currency Update (Automatic)
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?
Re: Currency Update (Automatic)
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.
Re: Currency Update (Automatic)
We can't see your server paths from the outside, but my best guess would be that you should set the first line to
PHP Code:
DEFINE('PATH_TO_STORE_ROOT','');
and set the next two back to
PHP 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');
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 folder
Re: Currency Update (Automatic)
: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
Re: Currency Update (Automatic)
Quote:
Originally Posted by
imnaughty
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:
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.
Re: Currency Update (Automatic)
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
Re: Currency Update (Automatic)
Quote:
Originally Posted by
frank18
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
Quote:
/usr/local/bin/php /home/MY_ACCOUNT/public_html/FOLDER/currency_update.php
then moved it to top level and used the command
Result: :clap::clap:
Re: Currency Update (Automatic)
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... :(