Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Last active November 24, 2015 06:57
Show Gist options
  • Save d1i1m1o1n/31903cdc7f3a5807e515 to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/31903cdc7f3a5807e515 to your computer and use it in GitHub Desktop.
Bitrix menu ext. Get subdirectories from current directory
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if(CModule::IncludeModule("iblock")) {
$IBLOCK_ID = 174;
//пример выборки подразделов для раздела
$rsParentSection = CIBlockSection::GetList(array(), array('IBLOCK_TYPE' => '1c_catalog', 'IBLOCK_ID' => $IBLOCK_ID, 'CODE' => $_REQUEST["SECTION_CODE"]));
if ($arParentSection = $rsParentSection->GetNext()) {
$arFilter = array('IBLOCK_ID' => $IBLOCK_ID,'>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'],'<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'],'DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']+1); // выберет потомков без учета активности
$rsSect = CIBlockSection::GetList(array('left_margin' => 'asc'),$arFilter);
while ($arSect = $rsSect->GetNext()) {
$aMenuLinksExt[] = Array(
$arSect['NAME'],
"/catalog/".$arSect['CODE']."/",
Array(),
Array(),
""
);
}
}
}
$aMenuLinks = array_merge($aMenuLinksExt, $aMenuLinks);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment