Bitrix Site Manager

CCatalogGroup::Add

int
CCatalogGroup::Add(
 array arFields
);

The method Add adds a new price type. This method stores both all the language-dependent and independent parameters. Additionally, you can specify user groups allowed to view and purchase products at prices of this type.

Parameters

ParameterDescription
arFields Associated array with the parameters of the new price type. In this array, keys are the parameters names. The following key names are allowed.
  • NAME - internal name of the price type;
  • SORT - sort weight;
  • USER_GROUP - array with the ID's of user groups that are allowed to view prices of this type;
  • USER_GROUP_BUY - array with the ID's of user groups that are allowed to purchase items at prices of this type;
  • USER_LANG - array with the language-dependent parameters of the price type. Keys in this array are the language ID's, and values are names of the price type in the corresponding language.

Return Values

Returns the ID of the new price type on success, or false otherwise.

Example



<?
$arFields = array(
   "NAME" => "retail",
   "SORT" => 100,
   "USER_GROUP" => array(2, 4),   // allow members of groups 2 and 4 to view
   "USER_GROUP_BUY" => array(2),  // allow members of group 2 to purchase
   "USER_LANG" => array(
      "fr" => "Prix de détail",
      "en" => "Retail price"
      )
);

$ID = CCatalogGroup::Add($arFields);
if ($ID<=0)
   echo "Error adding the price type";
?>