Community Add-Ons

Maintainers: sylvioruiz
Add file to this package
Top » Other

Onda and Xe Fixed
for osCommerce Online Merchant v2.2

Download
by sylvioruiz / 20 Oct 2012

I started to play again with osCommerce after 7 years and i would like to say that it still my favorite framework for e-business.
We can do amazing things now applying html5, css3 and js frameworks like jquery.
osCommerce is the base for my new e-commerce project and i want to improve its development.

Ok, the function for update currencies was not working well due html changes on the providers of the service (onda and xe).
I fixed the code and you can update it easily.

The code below works for all 2.2 and 2.3 subversions.

===================

local : catalog > admin > includes > functions > localization.php
support : (PHP 4 >= 4.3.0, PHP 5)

Replace all code by :

function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
$page = html_entity_decode(file_get_contents('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) {
$page = html_entity_decode(file_get_contents('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;
}
}

===================

The code below is attached if you want to download it.
Just replace the original oscommerce file by this.

Legend:  Download   Report

Expand All / Collapse All

Onda and Xe Fixed sylvioruiz 20 Oct 2012  

I started to play again with osCommerce after 7 years and i would like to say that it still my favorite framework for e-business.
We can do amazing things now applying html5, css3 and js frameworks like jquery.
osCommerce is the base for my new e-commerce project and i want to improve its development.

Ok, the function for update currencies was not working well due html changes on the providers of the service (onda and xe).
I fixed the code and you can update it easily.

The code below works for all 2.2 and 2.3 subversions.

===================

local : catalog > admin > includes > functions > localization.php
support : (PHP 4 >= 4.3.0, PHP 5)

Replace all code by :

function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
$page = html_entity_decode(file_get_contents('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) {
$page = html_entity_decode(file_get_contents('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;
}
}

===================

The code below is attached if you want to download it.
Just replace the original oscommerce file by this.