Array
(
[11] => Array
(
[IBLOCK_ID] => 1
[ID] => 11
[NAME] => Цилиндро-поршневая группа
[DEPTH_LEVEL] => 2
[IBLOCK_SECTION_ID] => 1
[CHILD] => Array
(
[29] => Array
(
[IBLOCK_ID] => 1
[ID] => 29
[NAME] => Втулки (Полуфабрикат)
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
[30] => Array
(
[IBLOCK_ID] => 1
[ID] => 30
[NAME] => Кольца поршневые
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
[31] => Array
(
[IBLOCK_ID] => 1
[ID] => 31
[NAME] => Комплекты ЦПГ
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
[33] => Array
(
[IBLOCK_ID] => 1
[ID] => 33
[NAME] => Палец поршневой
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
[32] => Array
(
[IBLOCK_ID] => 1
[ID] => 32
[NAME] => Поршень
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
[28] => Array
(
[IBLOCK_ID] => 1
[ID] => 28
[NAME] => Цильза
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 11
)
)
)
[12] => Array
(
[IBLOCK_ID] => 1
[ID] => 12
[NAME] => Система охлаждения
[DEPTH_LEVEL] => 2
[IBLOCK_SECTION_ID] => 1
[CHILD] => Array
(
[36] => Array
(
[IBLOCK_ID] => 1
[ID] => 36
[NAME] => Термостат
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 12
)
[35] => Array
(
[IBLOCK_ID] => 1
[ID] => 35
[NAME] => Привод вентилятора
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 12
)
[34] => Array
(
[IBLOCK_ID] => 1
[ID] => 34
[NAME] => Насос водяной
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 12
)
)
)
[13] => Array
(
[IBLOCK_ID] => 1
[ID] => 13
[NAME] => Система впуска
[DEPTH_LEVEL] => 2
[IBLOCK_SECTION_ID] => 1
[CHILD] => Array
(
[37] => Array
(
[IBLOCK_ID] => 1
[ID] => 37
[NAME] => Турбокомпрессор
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 13
)
)
)
[10] => Array
(
[IBLOCK_ID] => 1
[ID] => 10
[NAME] => Кривошипно-шатунный механизм
[DEPTH_LEVEL] => 2
[IBLOCK_SECTION_ID] => 1
[CHILD] => Array
(
[25] => Array
(
[IBLOCK_ID] => 1
[ID] => 25
[NAME] => Втулки
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 10
)
[26] => Array
(
[IBLOCK_ID] => 1
[ID] => 26
[NAME] => Заглушка
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 10
)
[24] => Array
(
[IBLOCK_ID] => 1
[ID] => 24
[NAME] => Клапаны
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 10
)
[27] => Array
(
[IBLOCK_ID] => 1
[ID] => 27
[NAME] => Вкладыщи/Полукольца
[DEPTH_LEVEL] => 3
[IBLOCK_SECTION_ID] => 10
)
)
)
<div class="catalog__category-list-wrap">
<div class="catalog__category-list-box">
<button type="button" class="catalog__category-close mobile"></button>
<ul class="catalog__category-list">
<?=getSectionTree($arResult['HTML']); ?>
</ul>
</div>
</div>
function getSectionTree($arr) {
foreach ($arr as $section) {
ob_start();
getSectionTree($section['CHILD']);
$output = ob_get_clean();
include 'templates/tree.php';
}
}
<?php if($section['CHILD'] && $section['DEPTH_LEVEL'] > 2): ?>
<ul class="catalog__category-list">
<?php endif;?>
<li class="catalog__category-item">
<label>
<input type="radio" name="category" value="">
<span><?=$section['NAME']?></span>
</label>
<?php if($section['CHILD']):?>
<div class="catalog__category-list-box">
<button type="button" class="catalog__category-back-link back-link" value="">
<svg width="19" height="35" viewBox="0 0 19 35" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 1L6.66667 17.5L18 34H12.7798L1 17.5L12.7798 1H18Z" fill="#D62214" stroke="#D62214"/>
</svg>
<span><?=$section['NAME']?></span>
</button>
<?=$output?>
</div>
<?php endif;?>
</li>
<?php if($section['CHILD'] && $section['DEPTH_LEVEL'] > 2):?>
</ul>
<?php endif;?>
<li class="catalog__category-item">
<label>
<input type="radio" name="category" value="">
<span><?=$section['NAME']?></span>
</label>
<?php if($section['CHILD']):?>
<div class="catalog__category-list-box">
<button type="button" class="catalog__category-back-link back-link" value="">
<svg width="19" height="35" viewBox="0 0 19 35" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 1L6.66667 17.5L18 34H12.7798L1 17.5L12.7798 1H18Z" fill="#D62214" stroke="#D62214"/>
</svg>
<span><?=$section['NAME']?></span>
</button>
<ul class="catalog__category-list">
<?=$output?>
</ul>
</div>
<?php endif;?>
</li>