Documentation

AddCountry

This class has been deprecated. It's recommended to use methods of class Bitrix\Sale\Location.

int
CSaleLocation::AddCountry(
  array arFields
);

The method AddCountry adds a new country.

Parameters

ParameterDescription
arFieldsAssociated array with parameters of the country to be added. The following keys are possible:
  • NAME - the country name (language-independent);
  • SHORT_NAME - country name abbreviation (language-independent);
  • <language ID> - the key is the language name. The value is an associated array in the format:
    array("LID" => "language ID",
          "NAME" => "country name in this language",
          "SHORT_NAME" => "country name abbreviation
                           in this language").
    Such pair must be specified for every language in the system.

Returned values

Returns the new country ID on success or false otherwise.

Example


<?
$arCountry = array(
   "NAME" => "France",
   "SHORT_NAME" => "FR",
   "fr" => array(
      "LID" => "fr",
      "NAME" => "France",
      "SHORT_NAME" => "FR"
      )
   "en" => array(
      "LID" => "en",
      "NAME" => "France",
      "SHORT_NAME" => "FR"
      ),
);

$ID = CSaleLocation::AddCountry($arCountry);
if (IntVal($ID)<=0)
   echo "Error adding country";
?>

© «Bitrix24», 2001-2024
Up