D
D
Dmitry Zorin2021-07-06 14:19:56
1C-Bitrix
Dmitry Zorin, 2021-07-06 14:19:56

How to make a menu of one category in Bitrix?

Infoblock standard catalog

Task - here is a section /catalog/apple
. In this section, I add an include area, insert a new menu there, and I want it to generate a list of child categories /catalog/apple/iphone, /catalog/apple/ipad, / catalog/apple/mac (etc)

It is clear that you can manually add changing elements to this, but it is necessary that it be automatically displayed.

I tried following the example of connecting menu.ext type -

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

global $APPLICATION;
 
   $aMenuLinksExt = $APPLICATION->IncludeComponent(
  "bitrix:menu.sections", 
  "", 
  array(
    "IS_SEF" => "Y",
    "SEF_BASE_URL" => "/catalog/",
    "SECTION_PAGE_URL" => "#SECTION_CODE#/",
    "DETAIL_PAGE_URL" => "#SECTION_CODE#/#ELEMENT_CODE#",
    "IBLOCK_TYPE" => "1c_catalog",
    "IBLOCK_ID" => "15",
    "DEPTH_LEVEL" => "3",
    "CACHE_TYPE" => "A",
    "CACHE_TIME" => "3600"
  ),
  false
);
$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
?>

As a result, it displays the full menu from the very first categories, but you need exactly the menu of subsections of one category

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