K
K
kimqarkimqarkimqar2021-08-02 09:23:20
1C-Bitrix
kimqarkimqarkimqar, 2021-08-02 09:23:20

Bitrix how to sort by creation date of the first level section in catalog.section.list?

There is a catalog.section.list, the template is formed as follows:

<?
    $rs = new CDBResult;
    $rs->InitFromArray($arResult['SECTIONS']);
    $rs->NavStart(10);
    if($rs->IsNavPrint())
    {
        while ($arSection = $rs->Fetch()):
            $db_list = CIBlockSection::GetList(Array($by=>$order),
                $arFilter = Array("IBLOCK_ID"=>$arSection["IBLOCK_ID"], "ID"=>$arSection["ID"]), true, $arSelect=Array());
            while($ar_result = $db_list->GetNext()){
                $sectCountry = $ar_result['UF_STRANA'];
            }
            ?>
        <?     $file = CFile::GetPath($arSection["UF_ICO_TV"]);
            ?>
            <div class="tests__item tests-item">
                <a href="<?=$arSection["SECTION_PAGE_URL"]; ?>">
                    <div class="tests-item__image">
                        <img src="<?=$arSection['PICTURE']['SRC']?>" alt="">
                    </div>
                </a>
            </div>

How to sort by the creation date of the first level section (the newer the section, the higher it is)
The array with sections is in $arResult['SECTIONS']
There is an option to sort the array manually before the loop, but are there regular sorting functions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tgarl, 2021-08-02
@tgarl

In your case, only do the sorting yourself, it will not be regular

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question