Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: r52snip
Added: Oct 17, 2018 11:38 AM
Views: 16
  1.  
  2. $arFilter = array(             
  3.     'ACTIVE' => 'Y',
  4.     'IBLOCK_ID' => $arParams['IBLOCK_ID'],
  5.     'GLOBAL_ACTIVE'=>'Y',
  6. );
  7. $arSelect = array('IBLOCK_ID','ID','NAME','DEPTH_LEVEL','IBLOCK_SECTION_ID');
  8. $arOrder = array('DEPTH_LEVEL'=>'ASC','SORT'=>'ASC');
  9. $rsSections = CIBlockSection::GetList($arOrder, $arFilter, false, $arSelect);
  10. $sectionLinc = array();
  11. $arResult['ROOT'] = array();
  12. $sectionLinc[0] = &$arResult['ROOT'];
  13. while($arSection = $rsSections->GetNext()) {
  14.     $sectionLinc[intval($arSection['IBLOCK_SECTION_ID'])]['CHILD'][$arSection['ID']] = $arSection;
  15.     $sectionLinc[$arSection['ID']] = &$sectionLinc[intval($arSection['IBLOCK_SECTION_ID'])]['CHILD'][$arSection['ID']];
  16. }
  17. unset($sectionLinc);