U
U
undertakeroo2022-01-27 09:20:23
1C-Bitrix
undertakeroo, 2022-01-27 09:20:23

The script for displaying products in the catalog does not work, provided why?

Good afternoon. There is a task to hide the display of products in the catalog if there is no checkmark in the user field.

Script written:

$arSelect = Array(
                "ID",
                "SECTION_PAGE_URL"
            );
    $arFilter = Array(
                "IBLOCK_ID"            => 34,
                "!UF_SHOW_HEAD_MENU"=> 0,
                "ACTIVE"               => "Y"
            );
    $res      = CIBlockSection::GetList(Array(), $arFilter, false, $arSelect);
    $arTemp   = array();
    while($ob = $res->GetNextElement())
        {
            $arFields                              = $ob->GetFields();
            $arTemp[$arFields["SECTION_PAGE_URL"]] = $arFields;
        }
    unset($res);
    $arTempResult = array();
    foreach ($arResult as &$arMenuItem)
        {
            if ($arTemp[$arMenuItem['LINK']])
            {
                $arTempResult[] = $arMenuItem;
            }
        }
        $arResult = $arTempResult;
        unset($arTemp);
        unset($arTempResult);

but wherever I insert it, it does not function, where to dig?

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