Z
Z
zekin3752020-10-19 12:06:30
1C-Bitrix
zekin375, 2020-10-19 12:06:30

How to list a directory for a specific group of users?

Please help me solve the problem required in the standard bitrix catalog to implement the display of goods only to a certain group of users.

Looping through elements

<?foreach ($rowItems as $item):?>
                    <?
                    if (!empty($item['BIG_DATA'])) {
                        $viewMode = "grid";
                    }
                    ?>
                    <div class="<?=$viewModeClass?>" data-entity="items-row">
                        <?
                        $APPLICATION->IncludeComponent(
                            'bitrix:catalog.item',
                            'main',
                            array(
                                'RESULT' => array(
                                    'ITEM' => $item,
                                    'AREA_ID' => $areaIds[$item['ID']],
                                    'TYPE' => $viewMode,
                                    'BIG_LABEL' => 'N',
                                    'BIG_DISCOUNT_PERCENT' => 'N',
                                    'BIG_BUTTONS' => 'Y',
                                    'SCALABLE' => 'N',
                                    'ITEM_FEATURES_GRID' => $arParams["ITEM_FEATURES_GRID"],
                                    'ITEM_SECTION' => $arParams["ITEM_SECTION"] ? $arParams["ITEM_SECTION"] : "Y",
                                ),
                                'PARAMS' => $generalParams
                                    + array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
                            ),
                            $component,
                            array('HIDE_ICONS' => 'Y')
                        );
                        ?>
                    </div>
                <?endforeach?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2020-10-19
@anton99zel

if( in_array(5,CUser::GetUserGroup(CUser::GetID())))
{
//Твой компонент будет показан для группы 5
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question