Steve, the confirmation was mine but the add-on wasn't developed by me, I'm just a user like you!
Printable View
Steve, the confirmation was mine but the add-on wasn't developed by me, I'm just a user like you!
Then thank you for the confirmation, and thanks to the author for the add-on
Can anyone help out?
I have installed this mod once and it has worked great. I am setting up a new store with the multistore add on and i now get the error below.
Any ideas???Quote:
X-Powered-By: PHP/5.2.17
Content-type: text/html
the domain does not exist.
Have you posted in the wrong thread? Can't see what this has to do with the automatic currency update?
No i have installed the automatic currency updater and i am getting an error in the email from the cron job that says
i have the multisite contribution added to my site and when i remove the pce of code that you have to add to the includes/config fileQuote:
X-Powered-By: PHP/5.2.17
Content-type: text/html
the domain does not exist.
it works fine.Quote:
include_once('includes/config_sites/sites_switch.php');
How do i fix this??
i also got this error a couple of times from the cron email but it has quit now!!??!!??
Has anyone else got this working as well as multisite??Quote:
<br />
<b>Warning</b>: include_once(includes/config_sites/sites_switch.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in <b>/HOME*/USER_NAME/public_html/includes/configure.php</b> on line <b>2</b><br /> <br />
<b>Warning</b>: include_once() [<a href='function.include'>function.include</a>]: Failed opening 'includes/config_sites/sites_switch.php' for inclusion (include_path='.:/usr/share/pear') in <b>/HOME*/USER_NAME/public_html/includes/configure.php</b> on line <b>2</b><br />
The problems that you're reporting seem to be linked to the code added for multisite rather than the code being executed for this mod.
It's possible that this is because the multisite code or instructions are using relative rather than absolute paths, so if you run this mod from somewhere other than the root of your site, it can't resolve those paths properly. But that would need to diagnosed and fixed by somebody familiar with multisite.
Moi,
Oanda and XE keeps giving me errors, so I have added one more server and updated my code accordingly.
admin/includes/functions/localization.php
- added new function
admin/currencies.phpCode:function quote_ecb_currency($code, $base = DEFAULT_CURRENCY) {
$xml= new SimpleXMLElement(file_get_contents("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"));
# extract default currency's exchange rate.
$nzd = $xml->xpath("//*[@currency='".$base."']");
$base_rate = (float)$nzd[0]['rate'];
if ($base == 'EUR') {$base_rate=(float)1;}
# extract requested currency's exchange rate.
$nzd = $xml->xpath("//*[@currency='".$code."']");
$rate = (float)$nzd[0]['rate'];
if ($code == 'EUR') {$rate=(float)1;}
$new_rate = $rate/$base_rate;
if ($new_rate != 0) return $new_rate;
else return null;
}
- updated the 'update' with completely new code.
admin/includes/languages/english/currencies.phpCode:case 'update':
$currency = $db->Execute("select currencies_id, code, title from " . TABLE_CURRENCIES);
$servers = array('ecb', 'oanda', 'xe');
zen_set_time_limit(600);
while (!$currency->EOF) {
foreach($servers as $server_used){
$quote_function = 'quote_' . $server_used . '_currency';
$rate = $quote_function($currency->fields['code']);
if (!empty($rate)){
/* Add currency uplift */
if ($rate != 1 && defined('CURRENCY_UPLIFT_RATIO')) {$rate = (string)((float)$rate * (float)CURRENCY_UPLIFT_RATIO);}
$db->Execute("update " . TABLE_CURRENCIES . "
set value = '" . $rate . "', last_updated = now()
where currencies_id = '" . (int)$currency->fields['currencies_id'] . "'");
$messageStack->add_session(sprintf(TEXT_INFO_CURRENCY_UPDATED, $currency->fields['title'], $currency->fields['code'], $server_used), 'success');
break;
}
else $messageStack->add_session(sprintf(WARNING_SERVER_FAILED, $server_used, $currency->fields['title'], $currency->fields['code']), 'warning');
}
$currency->MoveNext();
}
zen_redirect(zen_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $_GET['cID']));
break;
- added new definition
I do not have automatic updates, but now I have European Central Bank (ECB) daily rates as a primary exchange rate server :clap:Code:define('WARNING_SERVER_FAILED', 'Warning: The exchange rate server (%s) failed for %s (%s)');
BTW. the original zencart code has a bug. If both, the primary(oanda) AND backup(xe) server fails to provide sane rate, the particular currency rate will become corrupt/zero.
As has been stated elsewhere, ECB support is built-in to v1.5.0, as well as resolution of the problem that would set values to 0 if the update failed. I can't speak to how any automated-update scripts work, but the core ZC code is fine.