Documentation

GetList

CDBResult
CCurrency::GetList(
 string &by, 
 string &order, 
 string lang = LANGUAGE_ID
);

This GetList method returns a list of currencies, sorted by the 'by' field in the 'order' sequence. The language-dependent values are returned for the language specified in the lang parameter which is the current language by default. Non-static method.

Method parameters

ParameterDescription
by Variable containing the currency sort order. The following values are possible:
  • currency - currency ID;
  • name - name of currency in the lang language ;
  • sort - sort index (default).
order Variable containing the sorting direction. The following values are possible:
  • asc - ascending (default);
  • desc - descending.
lang The ID of the language for which the language-dependent values are returned. Optional parameter.

Returned values

Returns an instance of the CDBResult class, each record in which is an array with the following keys.

Key Description
CURRENCY The three character currency code.
AMOUNT_CNT The number of currency units used by default to define the rate of exchange (for example, if CYP 10 equal to USD 21.58, 10 is the number of currency units).
AMOUNT The default rate of exchange. (One of currencies within a site must equal to 1. Such currency is called a base currency. Other currencies are defined relative to the base currency.)
SORT Sort order.
DATE_UPDATE The date that the record was last modified.
LID The language ID.
FORMAT_STRING Format string used to display amounts in this currency.
FULL_NAME Full name of the currency.
DEC_POINT Symbol used as decimal point when displaying amounts in this currency.
THOUSANDS_SEP Symbol used as thousands separator when displaying amounts in this currency.
HIDE_ZERO (Y/N) flag removes the displayed nonsignificant zeros of the fractional part of the price.

Examples of use


<?
// Display the list of currencies in the current language, sorted by name.
// Besides, display 11.95 in the format of this currency in the current language.
$lcur = CCurrency::GetList(($b="name"), ($order1="asc"), LANGUAGE_ID);
while($lcur_res = $lcur->Fetch())
{
    echo "[".$lcur_res["CURRENCY"]."] ".$lcur_res["FULL_NAME"].": ";
    echo CurrencyFormat(11.95, $lcur_res["CURRENCY"])."<br>";
}
?>
© «Bitrix24», 2001-2024