Documentation

Add

int
CSaleLocationGroup::Add(
  array arFields
);

The method Add adds a new group of locations.

Parameters

ParameterDescription
arFields Associated array whose keys are the location group parameter names, and the values are the parameter values.

The following keys are possible:
  • SORT - sort weight;
  • LOCATION_ID - array of the ID's of locations to be added to the group;
  • LANG - array of language-dependent parameters of the group. Each entry has the following format: array("LID"=>"parameter's language", "NAME"=>"Group name")

Returned values

Returns the ID of the new group on success or false otherwise.

Example


<?
$arFields = array(
   "SORT" => 150,
   "LOCATION_ID" => array(12, 34, 35, 36, 37),
   "LANG" => array(
      array("LID" => "en", "NAME" => "Group 1")
      array("LID" => "fr", "NAME" => "Groupe 1"),
   )
);

$ID = CSaleLocationGroup::Add($arFields);
if (IntVal($ID)<=0)
   echo "Error adding a group";
?>

© «Bitrix24», 2001-2024