Bitrix Site Manager

CIBlockElement::GetElementGroups

CDBResult
CIBlockElement::GetElementGroups(
 int ID
);

Retrieves sections to which the element is bound.

Parameters

ParameterDescription
ID Element ID.

Return Values

Returns an instance of CDBResult with section fields.

See Also

  • CDBResult
  • Section fields
  • CIBlockElement::SetElementSection()

    Example


    <?
    $db_old_groups = CIBlockElement::GetElementGroups($ELEMENT_ID);
    $ar_new_groups = Array($NEW_GROUP_ID);
    while($ar_group = $db_old_groups->Fetch())
         $ar_new_groups[] = $ar_group["ID"];
    CIBlockElement::SetElementSection($ELEMENT_ID, $ar_new_groups);
    ?>