Documentation

Add

bool
CCurrencyLang::Add(
 array arFields
);

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

Method 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).
  • 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 "# 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, 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