Zen Follower
- Join Date:
- May 2010
- Location:
- Athens, Greece
- Posts:
- 293
- Plugin Contributions:
- 0
Currency Update (Automatic)
Steve, the confirmation was mine but the add-on wasn't developed by me, I'm just a user like you!
George
Athens Collectibles
Views: 82,431
Zen Follower
Steve, the confirmation was mine but the add-on wasn't developed by me, I'm just a user like you!
George
Athens Collectibles
Zen Follower
Then thank you for the confirmation, and thanks to the author for the add-on
Steve Pembleton
https://www.cheapjumprings.com
Zen Follower
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.
X-Powered-By: PHP/5.2.17
Content-type: text/htmlthe domain does not exist.
Any ideas???
Totally Zenned
Have you posted in the wrong thread? Can't see what this has to do with the automatic currency update?
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Zen Follower
kuroi:
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
X-Powered-By: PHP/5.2.17
Content-type: text/htmlthe domain does not exist.
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 file
include_once('includes/config_sites/sites_switch.php');
it works fine.
How do i fix this??
Zen Follower
i also got this error a couple of times from the cron email but it has quit now!!??!!??
<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 />
Has anyone else got this working as well as multisite??
Totally Zenned
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.
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
New Zenner
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
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;
}
admin/currencies.php
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;
admin/includes/languages/english/currencies.php
define('WARNING_SERVER_FAILED', 'Warning: The exchange rate server (%s) failed for %s (%s)');
I do not have automatic updates, but now I have European Central Bank (ECB) daily rates as a primary exchange rate server :clap:
New Zenner
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.
Sensei
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.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
New Zenner
Hi
I set up a new Zen Cart site 1.39h and installed the automatic currency update. The default currency in JMD (jamaican dollars) and I also have US dollars. I am getting a division by zero error message when the currency update runs.
<b>Warning</b>: Division by zero in <b>/<my path>/currency_update.php</b> on line <b>71</b><br />
Do you have any suggestions?
Thanks
b
New Zenner
OK - I see that the ECB XML file does not include the Jamaican Dollar. I see references to Oanda in this thread. Will read tomorrow when I am not so tired.
Thanks
b
Zen Follower
Hello,
I have several currencies on my zencart installation and all of them update fine using the manual update. The following don't update using the automatic updater although the other 8 do!
Argentinian Peso ARS
Barbadian Dollar BBD
Jamaican Dollar JMD
Trinidadian Dollar TTD
Does anyone have any ideas as to why they don't update automatically???
Zen Follower
Hi,
The mod gets the rates from the ECB site. ECB does not publish rates for every currency in the world and those mentioned above are obviously not included in the list.
Check the ECB published rates to see currencies included.
George
Athens Collectibles
New Zenner
I have a similar problem. I have change the root path to as per suggested post #223
How will I know if the mod works?
New Zenner
magwongpc:
I have a similar problem. I have change the root path to as per suggested post #223
How will I know if the mod works?
I think it's working now. It's something to do with my web hosting.
They corrected the problem.
I am receiving CRON emails which is empty in the text area so it should be working right?:clap:
Zen Follower
I am receiving CRON emails which is empty in the text area so it should be working right?Right, well done! :yes:
George
Athens Collectibles
New Zenner
I have the mod working but I realised that as the exchange rate comes from ECB site, it publishes the rate default to EURO so it meesed up my exchange rates. Please advice can I do? ECB has most but 1 of the currency that I listed.
I installed mod v2 and it works very well. However, I just read the thread and realised that it is not legal to use?
I am new to php and zencart so please advice how should I go about this?
Many thanks
Zen Follower
Will v4.0 work with Zencart 1.5?
Steve Pembleton
https://www.cheapjumprings.com
Sensei
FYI - The ECB support is built-in to v1.5.0
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Tell staff why this post should be reviewed.