N
N
Nikolai2019-04-18 18:15:55
1C-Bitrix
Nikolai, 2019-04-18 18:15:55

Output of infoblock subsections in html sitemap?

Good afternoon! How to display the correct links to infoblock subsections in the menu or sitemap. Now only the first level of the /katalog/stoly/ section works, but the categories of this section no longer work because I have links /katalog/odnosekcionnye/ although they should be like /katalog/stoly/odnosekcionnye/

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
    if(CModule::IncludeModule("iblock"))
    {
    $IBLOCK_ID = 2; //здесь необходимо указать ID Вашего инфоблока
    $itemsSection = GetIBlockSectionList($IBLOCK_ID);
    while($arItem = $itemsSection->GetNext()) { 

    $aMenuLinksExt[] = Array(
                $arItem["NAME"],
                $arItem["SECTION_PAGE_URL"],
                Array(),
                Array(),
                ""
                );
    }
    }   
$aMenuLinks = array_merge($aMenuLinksExt, $aMenuLinks);
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Skibin, 2019-04-18
@megafax

$aMenuLinksExt = $APPLICATION->IncludeComponent(
    "bitrix:menu.sections",
    "",
    [
      "IBLOCK_TYPE_ID" => $iblock, // Тип IBLOCK
      "IBLOCK_ID"      => $iblockId, // ID IBLOCK
      "CACHE_TYPE"     => "A",
      "CACHE_TIME"     => "86400",
      "DEPTH_LEVEL"    => "1", // Вложенность
    ],
    FALSE,
    ['HIDE_ICONS' => 'Y']
  );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question