R
R
RudFox2022-01-14 17:35:49
1C-Bitrix
RudFox, 2022-01-14 17:35:49

Why do subcategories display all categories and not the current one?

How to make subcategories of only the current (open category) displayed, and not from all at once.
Component in template:

$APPLICATION->IncludeComponent(
            "bitrix:catalog.section.list", 
            "sections_fotogallery", 
            array(
                "VIEW_MODE" => "TEXT",
                "SHOW_PARENT_NAME" => "Y",
                "IBLOCK_TYPE" => "aspro_max_catalog",
                "IBLOCK_ID" => $arParams["IBLOCK_ID"],
                "SECTION_ID" => $arResult["PARENT_ID"],
                "SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"],
                "SECTION_URL" => "",
                "COUNT_ELEMENTS" => "Y",
                "TOP_DEPTH" => "2",
                "SECTION_FIELDS" => array(
                    0 => "",
                    1 => "",
                ),
                "SECTION_USER_FIELDS" => array(
                    0 => "",
                    1 => "",
                ),
                "ADD_SECTIONS_CHAIN" => "N",
                "CACHE_TYPE" => "A",
                "CACHE_TIME" => "36000000",
                "CACHE_NOTES" => "",
                "CACHE_GROUPS" => "Y",
                "COMPONENT_TEMPLATE" => "sections_fotogallery",
                "COUNT_ELEMENTS_FILTER" => "CNT_ACTIVE",
                "FILTER_NAME" => "sectionsFilter",
                "CACHE_FILTER" => "N"
            ),
            false
        );


And output:
<?foreach( $arResult["SECTIONS"] as $arItems ){
                if($arItems["DEPTH_LEVEL"] == 2):
          ?>
          <div class="photogallery-section">
              <a id="sectionlink<?=$arItems["ID"]?>" href="/photos/<?=$arItems["ID"]?>/" class="section-compact-list__link dark_link option-font-bold"><span><?=$arItems["NAME"]?></span></a>
            </div>
      <?
                endif;
            }?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question