S
S
SpeakeazyYT12019-08-04 17:55:25
1C-Bitrix
SpeakeazyYT1, 2019-08-04 17:55:25

Why are elements that do not belong to any section from the infoblock selected with the SECTION_ACTIVE and SECTION_GLOBAL_ACTIVE criteria in the Bitrix filter?

Good evening. There is a code for selecting elements from the infoblock, and in the filter I specified the SECTION_ACTIVE and SECTION_GLOBAL_ACTIVE criteria to exclude elements from the selection that are linked to inactive child sections.
Here is the code:

// Выборка элементов указанных инфоблоков
  $rsElement = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblock_ids, "ACTIVE" => "Y", "SECTION_ACTIVE" => "Y", "SECTION_GLOBAL_ACTIVE" => "Y"), false, false, $arSelect);
  while($arElement = $rsElement->Fetch())
  {
    $elems[$arElement["IBLOCK_NAME"]][] = $arElement;
  }

With all this, my selection result does not include elements that are not attached to any sections, that is, they are in the "top level".
Then the question is, how can I get such elements without affecting the SECTION_ACTIVE and SECTION_GLOBAL_ACTIVE criteria, so that I don't also get elements associated with inactive sections.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2019-08-04
@SpeakeazyYT1

<? 
array(
  "IBLOCK_ID" => $iblock_ids, 
  "ACTIVE" => "Y", 
  array(
    "LOGIC" => "OR",
    array( 
      "SECTION_ACTIVE" => "Y", 
      "SECTION_GLOBAL_ACTIVE" => "Y"
    ),
    array( 
      "IBLOCK_SECTION_ID" => 0, 
    )
  ),
)

A filter with complex logic has a description below the table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question