Bitrix Site Manager

CCurrencyLang::Add

bool
CCurrencyLang::Add(
 array arFields
);

The method Add is used to add new language dependent parameters to currency.

Parameters

ParameterDescription
arFields Associated array of the currency parameters whose keys are the parameter names and values are the parameter values.

The following keys are possible:
  • CURRENCY - the identifier of currency to which the language dependent parameters are added (required);
  • LID - the language ID (required);
  • FORMAT_STRING - format string used to display amounts of this currency in LID (required);
  • FULL_NAME - full name of the currency;
  • DEC_POINT - symbol used as a decimal point when displaying amounts (required);
  • THOUSANDS_SEP - symbol used as thousands separator when displaying amounts;
  • DECIMALS - number of digits in the fractional part of an amount (when displaying) (required).

Return Values

Returns true on success, or false otherwise.

Example


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