-
-
Save Elvinz/649c10215dfa6a9e7c02be3e02d5b04e to your computer and use it in GitHub Desktop.
Получить список разделов и их подразделов в 1С - Битрикс
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$res = CIBlockSection::GetList( | |
Array('name' => 'asc'), | |
Array('IBLOCK_ID' =>'5' , 'ACTIVE' => 'Y') | |
); | |
while ($row = $res->GetNext()) | |
{ | |
echo $row['NAME'].'<br>'; | |
$rsParentSection = CIBlockSection::GetByID($row['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()) | |
{ | |
echo '---'.$arSect['NAME'].'<br>'; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment