A
A
AlexMikhailov2020-11-30 19:11:04
1C-Bitrix
AlexMikhailov, 2020-11-30 19:11:04

How to programmatically remove a binding to a section?

Good evening!
You need to remove the current link to the section
. Here is part of the code

$dbOldGroups = CIBlockElement::GetElementGroups($arFields["ID"], true);
while($arGroup = $dbOldGroups->Fetch())
{
  $allGroup[]=$arGroup["ID"];
}
/*ЧАСТЬ КОДА*/
{
  if(array_search($rasp["ID"],$allGroup))
  {
    unset($allGroup[in_array($rasp["ID"],$allGroup)]);
  }
}
CIBlockElement::SetElementSection($arFields["ID"], $allGroup);


For some reason this method doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anubis_I, 2020-12-08
@Anubis_I

you can simply delete an unnecessary entry from the \Bitrix\Iblock\SectionElementTable table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question