
Originally Posted by
nithinalex
I was checking Automatic Currency Updater version 4.0 extension ...and found that currency conversion feed from European Central Bank's website do not contain Middle East Asian countries like UAE, Saudi Riyal, Kuwait Dinar etc Exchange rates......

So what to do for getting Currency Exchange rates from such Gulf countries??? .......
I live in Bahrain and our currency is not covered either.
There is some confusion as to legalities but if the code in the Zencart admin is legal, then this is legal as it is taken directly from there
Code:
<?php
/**
* @package admin
* @copyright Copyright 2003-2009 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: currencies.php 15074 2009-12-10 03:04:31Z drbyte $
*/
/* Code below from admin/currencies.php in Zencart 1.3.9h */
require('includes/application_top.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
case 'update_currencies':
$server_used = CURRENCY_SERVER_PRIMARY;
zen_set_time_limit(600);
$currency = $db->Execute("select currencies_id, code, title from " . TABLE_CURRENCIES);
while (!$currency->EOF) {
$quote_function = 'quote_' . CURRENCY_SERVER_PRIMARY . '_currency';
$rate = $quote_function($currency->fields['code']);
if (empty($rate) && (zen_not_null(CURRENCY_SERVER_BACKUP))) {
// failed to get currency quote from primary server - attempting to use backup server instead
$messageStack->add_session(sprintf(WARNING_PRIMARY_SERVER_FAILED, CURRENCY_SERVER_PRIMARY, $currency->fields['title'], $currency->fields['code']), 'warning');
$quote_function = 'quote_' . CURRENCY_SERVER_BACKUP . '_currency';
$rate = $quote_function($currency->fields['code']);
$server_used = CURRENCY_SERVER_BACKUP;
}
/* Add currency uplift */
if ($rate != 1 && defined('CURRENCY_UPLIFT_RATIO') && (int)CURRENCY_UPLIFT_RATIO != 0) {
$rate = (string)((float)$rate * (float)CURRENCY_UPLIFT_RATIO);
}
// special handling for JPY, which always uses whole numbers, never decimals
if ($code == 'JPY') {
$rate = (int)$rate;
}
if (zen_not_null($rate) && $rate > 0) {
$db->Execute("update " . TABLE_CURRENCIES . "
set value = '" . $rate . "', last_updated = now()
where currencies_id = '" . (int)$currency->fields['currencies_id'] . "'");
}
$currency->MoveNext();
}
/* relevant section from includes/application_bottom.php in Zencart 1.3.9h */
session_write_close();
?>
Save it as a php file under your ZC folder (choose any name apart from currency_update so that wreckers do not keep firing it off) and set up the cron job as explained elsewhere in this thread. Covers every currency just like the ZC admin does.
Bookmarks