D
D
DeeUs2019-12-05 12:15:06
1C-Bitrix
DeeUs, 2019-12-05 12:15:06

How to make a submenu from a specific section?

Hello!
in the infoblock "Catalog" the following structure is now:
section1
--subsection11
--subsection12
--subsection13
section2
--subsection21
--subsection22
--subsection23
section3
--subsection31
--subsection32
--subsection33
How to display only child sections of section2 in the drop-down menu?
That is, in the main menu, when hovering over the "catalog", a submenu should appear with the items subsection21, subsection22,
subsection23

layout of what i'm trying to do

5de8fb45d837f059704073.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Shevchenko, 2019-12-05
@WebDev2030

It's easier for you to just get a list of the necessary sections and form a menu.
Use CIBlockSection::GetList you should get something like this:

$rsSections = CIBlockSection::GetList(
    Array(),
    Array(
       "IBLOCK_ID" => "Твой инфоблок",
       "SECTION_ID" => "ID раздела-родителя",
       "DEPTH_LEVEL" => "2" //Скорее всего будет 2, не помню с 0 или с 1 считается 
    )
);
while($arSection => $rsSections->GetNext()) {
   //перебираешь секции и формируешь массив для меню.
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question