|
Update currency exchange rates 1 Year, 8 Months ago
|
Karma: 0
|
|
HI,
I have 3 currencies added. Croatian Kuna (HRK), Euro (EUR), US dollar (USD).
My default currency is HRK and updating is not working for for both web services (OANDA and XE).
Mybe I have done some wrong setup...?!
please help
D.
|
|
|
|
|
|
|
Re:Update currency exchange rates 1 Year, 8 Months ago
|
Karma: 7
|
|
I test the currencies module. It seem that some problem exist on Oanda web site so that the update action can't run successfully.But, when i add the HRK and set it as default currency, updating is working for XE. Please see the data below:
Currencies Code Value Example
British Pounds GBP 0.11523600 £1,499.99
Euro EUR 0.13843200 ¥1,499.99
HRK(default) HRK 1.00000000 #1,4999.99
|
|
|
|
|
|
|
Re:Update currency exchange rates 1 Year, 7 Months ago
|
Karma: 0
|
|
Is not working for me either with Oanda or XE
maybe I done some wrong settings...?!
d.
|
|
|
|
|
|
|
Re:Update currency exchange rates 1 Year, 7 Months ago
|
Karma: 29
|
|
Please check whether the code HRK is correct. The code is used to do this currency exchange rates calculation.
|
|
|
|
|
|
|
Re:Update currency exchange rates 1 Year, 7 Months ago
|
Karma: 0
|
|
For my currency the right code is HRK, I'm sure. But I don't understand.
I have second TC installed locally through XAMMP and I have the same version like on my domain, and I have the same currencies added, and from localhost works like in charms (it works by XE and OANDA too).
So I don't know where is the problem??
I will try to remove all my currencies and add them again to see it will be working then
D.
|
|
|
|
|
|
|
Re:Update currency exchange rates 1 Year, 7 Months ago
|
Karma: 0
|
I solved the mystery.
Here is a fix.
admin/includes/functions/localization.php should look like this:
| Code: |
<?php
/*
$Id: localization.php $
TomatoCart Open Source Shopping Cart Solutions
http://www.tomatocart.com
Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd; Copyright (c) 2003 osCommerce
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License v2 (1991)
as published by the Free Software Foundation.
*/
function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
//FIX
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, 1);
$page= curl_exec($ch);
curl_close($ch);
//END FIX
//insecure line $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code . '&format=CSV&dest=Get+Table&sel_list=' . $base);
$match = array();
preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', $page, $match);
if (sizeof($match) > 0) {
return $match[3];
} else {
return false;
}
}
function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
//FIX
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.xe.com/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, 1);
$page= curl_exec($ch);
curl_close($ch);
//END FIX
//insecure $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
$match = array();
preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', $page, $match);
if (sizeof($match) > 0) {
return $match[1];
} else {
return false;
}
}
?>
|
|
|
|
|
|
|
|