Documentation

Update

bool
CCurrencyLang::Update(
 string currency, 
 string lang, 
 array arFields
);

The Update method updates the language-dependent parameters of the specified currency for the specified language.

Parameters

ParameterDescription
currency The currency ID which language-dependent parameters are to be updated.
lang The language ID for which the language-dependent currency parameters are to be updated.
arFields Associated array of new parameters of the currency whose keys are the parameter names and values are the parameter values.

The following keys are possible:
  • CURRENCY - the currency identifier;
  • LID - the language ID;
  • FORMAT_STRING - format string according to which the amounts in this currency are displayed in this language;
  • FULL_NAME - the currency full name;
  • DEC_POINT - symbol used as a 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).

Returned values

Returns true on success, or false otherwise.

Examples of use


<?
$arFields = array(
    "FORMAT_STRING" => "# USD", // symbol # is 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, modify, 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