Documentation

Add

Description and parameters

int
CCatalogGroup::Add(
 array arFields
);

The method 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. Non-static method.

Parameters

ParameterDescription
arFields Associative array with the parameters of the new price type. In this array, keys are the parameter names. Permissible parameters:
  • BASE - flag (Y/N) indicates basic type (when added price type is Y and the system already has a specific base price type, the system unticks flag from existing type);
  • NAME - internal price type name;
  • SORT - sorting index;
  • XML_ID - external code код;
  • CREATED_BY - price type ID;
  • MODIFIED_BY - ID for most recent price type updater;
  • USER_GROUP - array with user group codes, with members to view prices of this type;
  • USER_GROUP_BUY - array with user group codes, with members able to purchase products by prices of this type;
  • USER_LANG - associative array with language-dependent price type parameters, with keys as language codes, and values - name for this price type on a corresponding language.

Returned value

Returns code for added price type or false otherwise.

Examples

<?
$arFields = array(
   "NAME" => "retail",
   "SORT" => 100,
   "USER_GROUP" => array(2, 4),   // visible to members of groups of 2 and 4
   "USER_GROUP_BUY" => array(2),  // purchase price
                                  // only members of group 2
   "USER_LANG" => array(
      "en" => "Retail"
      )
);

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

© «Bitrix24», 2001-2024