Когда-то использовали примерно такой код в result_modifier:
| Код |
|---|
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();?>
<?php
if (isset($arResult["ID"])) {
$arSections = array();
$rsParentSection = CIBlockSection::GetByID($arResult["ID"]);
if ($arParentSection = $rsParentSection->GetNext()) {
$arFilter = array(
"IBLOCK_ID" => $arParentSection["IBLOCK_ID"],
">LEFT_MARGIN" => $arParentSection["LEFT_MARGIN"],
"<RIGHT_MARGIN" => $arParentSection["RIGHT_MARGIN"],
">DEPTH_LEVEL" => $arParentSection["DEPTH_LEVEL"]
); //Фильтр для получения потомков без учета активности
$rsSect = CIBlockSection::GetList(array("left_margin" => "asc"), $arFilter);
while ($arSect = $rsSect->GetNext()) {
$arSections[] = $arSect["ID"];
}
$arSections[] = $arResult["ID"];
$arFilter = array(
"IBLOCK_ID" => IntVal($arResult["IBLOCK_ID"]),
"ACTIVE_DATE" => "Y",
"ACTIVE" => "Y",
"SECTION_ID" => $arSections,
"SECTION_GLOBAL_ACTIVE" => "Y"
);
$iCount = CIBlockElement::GetList(array(), $arFilter, array(), false, array());
}
} |
Возможно поможет.