TomatoCart

65377 Downloads
146 users online
TomatoCart Community
Welcome, Guest
Please Login or Register.    Lost Password?
Bookmark and Share

Update currency exchange rates
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Update currency exchange rates
#1233
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.
danijelp
Moderator
Posts: 96
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Zagreb, Croatia Birthday: 05/24
The administrator has disabled public write access.
 
#1242
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
jack.yin
Team Member
Posts: 893
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1405
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.
danijelp
Moderator
Posts: 96
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Zagreb, Croatia Birthday: 05/24
The administrator has disabled public write access.
 
#1645
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.
zheng.lei
Team Member
Posts: 462
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1649
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.
danijelp
Moderator
Posts: 96
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Zagreb, Croatia Birthday: 05/24
The administrator has disabled public write access.
 
#1650
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;
}
}

?>

danijelp
Moderator
Posts: 96
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Zagreb, Croatia Birthday: 05/24
The administrator has disabled public write access.
 
Go to top Page: 1

Latest Blog Post

TomatoCart v2.0 – An open source ecommerce framework

Since the TomatoCart v1.0’s framework getting old and the core is not a pure MVC design, it causes many troubles ...

Blog | Administrator | Saturday, 21 January 2012

More in: About Us

-
+
3

contact_us

TomatoCart
+86-13771170725
info@tomatocart.com
http://www.tomatocart.com

Newsletter Subscription

Name:

E-Mail:

Verification Code:
Captcha

Receive HTML?