Documentation

Update

bool
CCatalogGroup::Update(
 int ID, 
 array arFields
);

Method updates parameters for price type with ID to the values from the arFields array. Both language-dependent and -independent parameters are saved. Also, there's an option to specify user groups with permissions to view and purchase products with prices of this type. Non-static method.

Call parameters

ParameterDescription
ID Updated price type ID.
arFields Associative array with parameters for price type, with keys as parameter names and new values. Permissible parameters:
  • BASE - flag (Y/N) for basic type;
  • NAME - internal price type name;
  • SORT - sort index;
  • XML_ID - external code;
  • MODIFIED_BY - ID for the the most recent user who updated the price type;
  • USER_GROUP - array with user group codes, with members permitted to view prices of this type;
  • USER_GROUP_BUY - array with user group codes, with members allowed to view products with prices of this type;
  • USER_LANG - associative array with language-dependent parameters for price type, with keys as language codes and values as price type names on an applicable language.

Returned values

Returns true on successfully updated price type parameters and false otherwise.

Example

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

if (!CCatalogGroup::Update($ID, $arFields))
   echo "Error adding price type";
?>

© «Bitrix24», 2001-2024
Up