V
V
Vasily Petrov2016-07-17 14:19:41
1C-Bitrix
Vasily Petrov, 2016-07-17 14:19:41

How to display a list of subcategories in the infoblock?

There is an info block.
It has main sections in which there can be subsections.
Products can be both in the main section and in subsections.
Question.
How to make it so that if there are subsections in the main section, then they would be displayed (only a list of subsections)
if there are no subsections, then goods would be displayed
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-07-17
@token_bus

Make a check in sections.php. There is a bitrix:catalog.section.list component that displays a list of subcategories, see what it returns. And see what $arResult returns, maybe there is something related to the parent

D
DM, 2020-03-13
@neverenn

For example:

<?$filter_7 = array('IBLOCK_ID'=>"13", 'ACTIVE'=>'Y');
         $db_list_id7 = CIBlockSection::GetList(array(), $filter_7, true, Array("UF_DATE"));
         while ($arSect = $db_list_id7->GetNext()){
         $arSect["photo"] = CFile::GetPath($arSect["PICTURE"]);
         ?>
         <a class="picsposition" href="/<?=$arSect["CODE"]?>">
            <div class="picsin" style="background-image: url(<?=$arSect["photo"]?>);background-size: 80%; background-position: center;background-repeat: no-repeat;">
            </div>
            <div class="textin"><p><?=$arSect["NAME"]?></p></div>
         </a>

         <? } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question