shopkod
2/6/2020 - 10:08 AM

CIBlockElement::GetList

<?
$arOrder = ['SORT' => 'ASC']; 
$arFilter = [
	"IBLOCK_ID" => $IBLOCK_ID,
]; 
$arSelect = ['ID', 'NAME']; 
$rsElements = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect); 
while($arElement = $rsElements->Fetch()) 
{ 
    
}

// Выборка всех элементов раздела (включая подразделы)
$cntElement = CIBlockElement::GetList([], [
  "IBLOCK_ID" => $arParams["IBLOCK_ID"],
  "SECTION_ID" => $arSection['ID'],
  "ACTIVE" => "Y",
  "INCLUDE_SUBSECTIONS" => "Y",
  "SECTION_ACTIVE" => "Y",
  "SECTION_GLOBAL_ACTIVE" => "Y"
  ], []);
  
// Выборка всех элементов только данного раздела
$cntElementInCurrentSection = \Bitrix\Iblock\ElementTable::getCount([
  "IBLOCK_ID" => $arParams["IBLOCK_ID"],
  "IBLOCK_SECTION_ID" => $arSection['ID'],
  "ACTIVE" => "Y",
], [
  'ttl' => 3600,
  'cache_joins' => true
]);