A
A
arozhk2018-10-24 14:45:40
1C-Bitrix
arozhk, 2018-10-24 14:45:40

How to make a conclusion of sections 1s Bitrix?

It is not possible to display a list of store subsections in Bitrix.

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true); ?>

<div class="block-title size-3"><?=$arResult["TOP_SECTION"]["NAME"]?></div>
<div class="accordeon">
  <? // тут первый уровень, работает ?>
<? foreach ($arResult["SECTIONS2"] as $arSection2) { if (empty($arResult["SECTIONS3"][$arSection2["ID"]])) { ?>	

<div class="accordeon-title2<?if ($arSection2["SELECTED"] == "Y") echo ' active'?>">
<a href="<?=$arSection2["SECTION_PAGE_URL"]?>"><?=$arSection2["NAME"]?></a></div>
<? } else { ?>
   
<div class="accordeon-title<?if ($arSection2["SELECTED"] == "Y") echo ' active'?>"><?=$arSection2["NAME"]?></div>

<? if (!empty($arResult["SECTIONS3"][$arSection2["ID"]])) { ?>
<div class="accordeon-entry"<?if ($arSection2["SELECTED"] == "Y") echo ' style="display:block"'?>>
<div class="article-container style-1">
  
    <? // тут второй уровень, работает ?>
<ul><?	foreach ($arResult["SECTIONS3"][$arSection2["ID"]] as $arSection3) { ?>
<li<? if ($arSection3["SELECTED"] == "Y") echo ' class="active"';?>><a href="<?=$arSection3["SECTION_PAGE_URL"]?>">
<?=$arSection3["NAME"];?></a>

<? // тут вывод на уровень глубже, не работает ?>
  
<? if (!empty($arResult["SECTIONS4"][$arSection3["ID"]])) { ?>
  <ul><?	foreach ($arResult["SECTIONS4"][$arSection3["ID"]] as $arSection4) { ?>
    <li<? if ($arSection4["SELECTED"] == "Y") echo ' class="active"';?>><a href="<?=$arSection4["SECTION_PAGE_URL"]?>">
      <?=$arSection4["NAME"];?></a></li><? } ?>
  </ul>	
    <?} ?>
    </li>
  <? } ?>
    </ul>
    </div>
    </div>
  <? }}} ?>								
 </div>  

Помогите советом.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jupiter Max, 2018-10-24
@vardoLP

try using catalog.section.list component with tree template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question