Answer the question
In order to leave comments, you need to log in
How to get a directory partition tree in the form of a nested array in Bitrix?
There is a directory with sections, which, of course, are nested into each other (the stone managed to find out from the docks in Bitrix, this is decided at the level of service properties LEFT_MARGIN, RIGHT_MARGIN and DEPTH_LEVEL).
Is there a functionality that returns a section tree from a specified element (for example, from CIBlockSection::GetByID) as a multidimensional array, where the nesting of elements corresponds to the PARREN -> CHILD scheme?
Answer the question
In order to leave comments, you need to log in
select sections using CIBlockSection::GetTreeList, and fill the resulting array (use LEFT_MARGIN+DEPTH_LEVEL)
There is NO
standard method in the Bitrix API that would return a section tree from the specified element .
But you can use CIBlockSection::GetNavChain , which returns the tree path from the root to the SECTION_ID section as an array.
If it is important for you to see the output data set in the form of a tree, write a wrapper function over CIBlockSection::GetNavChain, which will convert the bitrix array into the format you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question