2013年11月25日星期一

How to verify whether there is a currency type

How to verify whether there is a currency type?
The zencart zen_currency_exists test function is specified currency currency code exists to return the money if the currency code exists, if not, it returns false the first argument is the designated currency of code, such as U.S. dollar is usd
The second parameter is the default currency if the return is the site specified default currency exchange rate of 1
Function prototype code
function zen_currency_exists ($ code, $ getFirstDefault = false) {
global $ db;
$ code = zen_db_prepare_input ($ code);
$ currency_code = "select code
from ". TABLE_CURRENCIES."
where code = '".. zen_db_input ($ code)"' LIMIT 1 ";
$ currency_first = "select code
from ". TABLE_CURRENCIES."
order by value ASC LIMIT 1 ";
$ currency = $ db-> Execute (? ($ getFirstDefault == false) $ currency_code: $ currency_first);
if ($ currency-> RecordCount ()) {
return strtoupper ($ currency-> fields ['code']);
} Else {
return false;
}
}

which one

Tagged under: ,

0 评论:

发表评论