Community Add-Ons

Maintainers: Jordi
Add file to this package
Top » Other

CURRENCY BUG (Fixed)
for osCommerce Online Merchant v2.2

http://www.yourdomain.com/?currency=eur
It display no price, and a customer can buy it...

Find on includes/application_top.php


// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
if (!tep_session_is_registered('currency')) tep_session_register('currency');

if (isset($HTTP_GET_VARS['currency'])) {
if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
} else {
$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
}



Replace with:

// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
if (!tep_session_is_registered('currency')) tep_session_register('currency');

if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
$currency = $HTTP_GET_VARS['currency'];
} else {
$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
}




Find on includes/functions/general.php



////
// Checks to see if the currency code exists as a currency
// TABLES: currencies
function tep_currency_exists($code) {
$code = tep_db_prepare_input($code);

$currency_code = tep_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . tep_db_input($code) . "'");
if (tep_db_num_rows($currency_code)) {
return $code;
} else {
return false;
}
}


Replace with:



////
// Checks to see if the currency code exists as a currency
// TABLES: currencies
function tep_currency_exists($code) {
$code = tep_db_prepare_input($code);

$currency_query = tep_db_query("select code from " . TABLE_CURRENCIES . " where code = '" . tep_db_input($code) . "' limit 1");
if (tep_db_num_rows($currency_query)) {
$currency = tep_db_fetch_array($currency_query);
return $currency['code'];
} else {
return false;
}
}


Thats All.
More info on Spanish Oscommerce Support forums.
http://oscommerce.qadram.com/modules.php?name=Forums

Legend:  Download   Report
Expand All / Collapse All
CURRENCY BUG (Fixed) Jordi 22 Aug 2007  

http://www.yourdomain.com/?currency=eur
It display no price, and a customer can buy it...

Find on includes/application_top.php


// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
if (!tep_session_is_registered('currency')) tep_session_register('currency');

if (isset($HTTP_GET_VARS['currency'])) {
if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
} else {
$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
}



Replace with:

// currency
if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
if (!tep_session_is_registered('currency')) tep_session_register('currency');

if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
$currency = $HTTP_GET_VARS['currency'];
} else {
$currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
}




Find on includes/functions/general.php



////
// Checks to see if the currency code exists as a currency
// TABLES: currencies
function tep_currency_exists($code) {
$code = tep_db_prepare_input($code);

$currency_code = tep_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . tep_db_input($code) . "'");
if (tep_db_num_rows($currency_code)) {
return $code;
} else {
return false;
}
}


Replace with:



////
// Checks to see if the currency code exists as a currency
// TABLES: currencies
function tep_currency_exists($code) {
$code = tep_db_prepare_input($code);

$currency_query = tep_db_query("select code from " . TABLE_CURRENCIES . " where code = '" . tep_db_input($code) . "' limit 1");
if (tep_db_num_rows($currency_query)) {
$currency = tep_db_fetch_array($currency_query);
return $currency['code'];
} else {
return false;
}
}


Thats All.
More info on Spanish Oscommerce Support forums.
http://oscommerce.qadram.com/modules.php?name=Forums