I've dumped the file up on my server, altered the root path and it works!
However, if I don't set up the cron job at all, I wont be able to get automatic updates will I?
In which case, I can just run it say once a day myself by typing in the URL?
Printable View
I've dumped the file up on my server, altered the root path and it works!
However, if I don't set up the cron job at all, I wont be able to get automatic updates will I?
In which case, I can just run it say once a day myself by typing in the URL?
Well yes, you could do that. But you could also just click the update button on the currencies page in the Admin.
I have currency update script working ok.
But on my zen cart site I want Euros as the default currency rather than customers having to select euros, so I have euros set as the default currency.
But with us purchasing in US dollars I want to update the other currencies based on the US dollar and the script uses the default currency to update the others.
Any ideas if there is a way I can achieve this please?
@jezspain
You're probably attacking this from the wrong end.
Basically of your goods are priced in dollars then your currency conversions need to default to the same currency.
If you want to present a different currency as the default for customers, you need to go to the place that this default is set. This is in the includes/init_includes/init_currencies.php which you can copy to the overrides folder and then replace the reference to DEFAULT_CURRENCY with that which you would like to present first to customers.
Give it a good test though, as I haven't actually tried this in practise.
Thanks for the reply Kurio, I think you are right.
I will give it a try from that angle. I have a test site I will try it on first.
@ Kurio,
Not sure if you can help further.
I understood the principle of what you said in your post but I am not sure how to implement it. I copied init_currencies.php into the overides folder, but I don't know enough to know what/where to change the code to get the customer to always see the price in euros first while the default currency is set to US dollars.
I am not sure how hard or easy it is to achieve this but it would be much appreciated if you/someone could help me..
Posting the code below: -
[SCR]
<?php
/**
* initialise currencies
* see {@link http://www.zen-cart.com/wiki/index.p...als#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: init_currencies.php 6300 2007-05-11 15:49:41Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
// If no currency is set, use appropriate default
if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = DEFAULT_CURRENCY;
// Validate selected new currency, if any. Is false if valid not found.
$new_currency = (isset($_GET['currency'])) ? zen_currency_exists($_GET['currency']) : zen_currency_exists($_SESSION['currency']);
// Validate language-currency and default-currency if relevant. Is false if valid not found.
if ($new_currency == false || isset($_GET['language'])) $new_currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? zen_currency_exists(LANGUAGE_CURRENCY) : $new_currency;
// Final check -- if selected currency is bad and the "default" is bad, default to the first-found currency in order of exch rate.
if ($new_currency == false) $new_currency = zen_currency_exists(DEFAULT_CURRENCY, true);
//echo '<br />NEW = ' . $new_currency . '<br />';
// Now apply currency update
if (
// Has new currency been selected?
(isset($_GET['currency'])) ||
// Does language change require currency update?
(isset($_GET['language']) && USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency'] )
) {
$_SESSION['currency'] = $new_currency;
// redraw the page without the currency/language info in the URL
if (isset($_GET['currency']) || isset($_GET['language'])) zen_redirect(zen_href_link($current_page_base, zen_get_all_get_params(array('currency','language'))));
}
?>[/SCR]
Hello, could anyone help with this?
I uploaded the script to /public_html/my shopname.com. I got the right command from my hosting company. They say it should be:
/usr/bin/php -q /home/my username/public_html/myshopname.com/currency_update.php and I have used wrong path. Yes, I used just '/', so I corrected it to: /public_html/my shopname.com/currency_update.php.
And now I get messages:
PHP Warning:
require_once(/public_html/myshopname.com/currency_update.phpincludes/configure.php)
[<a href='function.require-once'>function.require-once</a>]: failed to open stream:
No such file or directory in
/home/myusername/public_html/myshopname.com/currency_update.php on line 20
<br />
<b>Warning</b>:
require_once(/public_html/myshopname.com/currency_update.phpincludes/configure.php)
[<a href='function.require-once'>function.require-once</a>]: failed to open stream:
No such file or directory in
<b>/home/myusername/public_html/myshopname.com/currency_update.php</b> on line
<b>20</b><br />
PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]:
Failed opening required
'/public_html/myshopname.com/currency_update.phpincludes/configure.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
/home/myusername/public_html/myshopname.com/currency_update.php on line 20
<br />
<b>Fatal error</b>: require_once() [<a
href='function.require'>function.require</a>]: Failed opening required
'/public_html/myshopname.com/currency_update.phpincludes/configure.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
<b>/home/myusername/public_html/myshopname.com/currency_update.php</b> on line
<b>20</b><br />
What does it mean? What should I change?
Any help, please:(
OK, it seems to work now. My path is /home/myusername/public_html/myshopname.com/ without "currency_update.php"
@jezspain
Simply change
toQuote:
if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = DEFAULT_CURRENCY;
Then open up a new browser window as the change will work only when there's not an old php session lurking, and you'll see it as you customers will.Quote:
if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = 'EUR';
This assumes, of course, that you have dollars and euros enabled as currencies, though there is protection in that file for if you don't.