Bitrix Site Manager

CCurrencyRates::Add

bool
CCurrencyRates::Add(
 array arFields
);

The method Add is used to add a new record in the exchange rate table.

Parameters

ParameterDescription
arFields Associated array of new currency rate parameters in which keys are the parameter names and values are the parameter values.

The following keys are possible:
  • CURRENCY - the ID of currency for which a rate is added (required);
  • DATE_RATE - the date for which the rate is being added (required);
  • RATE_CNT - the number of currency units used to define the rate of exchange (for example, if CYP 10 equal to USD 21.58, 10 is the number of currency units) (required);
  • RATE - 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.)

Return Values

Returns true on success, or false otherwise.

Example


<?
// Consider CYP a base currency.
// CYP rate for 10.08.2005 is 10 CYP for 21.58 USD

$arFields = array(
    "RATE" => 21.58    48.1756,
    "RATE_CNT" => 10,
    "CURRENCY" => "CYP",  "ISK",
    "DATE_RATE" => "10.08.2005"
    );

if (!CCurrencyRates::Add($arFields))
    echo "error adding rate";
?>