1С-Битрикс
25
Вклад в тег
$iBlockId = 10;
$sectionId = 53;
$filter = [
'IBLOCK_ID' => $iBlockId,
'ACTIVE' => 'Y',
'IBLOCK_SECTION_ID' => $sectionId
];
$select = [
'ID', 'IBLOCK_ID', 'countElements'
];
$runtime = [
'elements' => [
'data_type' =>"Bitrix\Iblock\ElementTable",
'reference' => [
'=this.IBLOCK_ID' => 'ref.IBLOCK_ID',
'=this.ID' => 'ref.IBLOCK_SECTION_ID',
'=this.ACTIVE' => 'ref.ACTIVE',
],
//'join_type' => "LEFT"
],
'countElements' => [
'data_type' => 'integer',
'expression' => ['count(%s)', 'elements.ID']
]
];
$res = Bitrix\Iblock\SectionTable::getList(
[
'filter' => $filter,
'select' => $select,
'runtime' => $runtime
]
);
while($section = $res->fetch())
{
\Bitrix\Main\Diag\Debug::dump($section, $section['ID']);
}