Documentation

GetByID

array
CCurrencyLang::GetByID(
 string currency, 
 string lang
);

GetByID returns language-dependent parameters for the specified currency of the specified language. Non-static method.

Method parameters

ParameterDescription
currency Currency ID, which language-dependent parameters are required.
lang Language ID for which the parameters are to be returned.

Returned values

Associated array containing the following keys:

Key Description
CURRENCY The three character currency code.
LID Language ID.
FORMAT_STRING Format string according to which the amounts in this currency are displayed in LID.
FULL_NAME Full name of the currency.
DEC_POINT Symbol used as decimal point when displaying amounts.
THOUSANDS_SEP Symbol used as thousands separator when displaying amounts.
DECIMALS Number of digits in the fractional part of an amount when displaying amounts.
HIDE_ZERO (Y|N) Defines, whether to hide or show nonsignificant zeros of the fractional part (the result will be visible only in public section).

Example


<?
$arFields = array(
    "FORMAT_STRING" => "# USD", // symbol # will be replaced
                                // with the real amount when displaying
    "FULL_NAME" => "Dollar",
    "DEC_POINT" => ".",
    "THOUSANDS_SEP" => "\xA0",  // NBSP
    "DECIMALS" => 2,
    "CURRENCY" => "USD",
    "LID" => "en"
);

// If the record exists, update, or add a new one otherwise
$db_result_lang = CCurrencyLang::GetByID("USD", "en");
if ($db_result_lang)
    CCurrencyLang::Update("USD", "en", $arFields);
else
    CCurrencyLang::Add($arFields);
?>
© «Bitrix24», 2001-2024
Up