D
D
DeeUs2019-04-19 13:46:20
1C-Bitrix
DeeUs, 2019-04-19 13:46:20

How to get the elements associated with the current element?

Hello!
How to get the elements associated with the current one?
Let's say there are 2 infoblocks: products and brands.
products have a "brand" field (type - "Binding to elements in the form of a list") in which you can select a brand.
how to display products related to it on the page of a specific brand?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2cha.headz, 2019-04-19
@glagolew059

$arSelect = Array("*");
$arFilter = Array("IBLOCK_ID"=>$IBLOCK_ID, "PROPERTY_BRAND"=>$BRAND_ID);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
while($ob = $res->GetNextElement()) {
 $arFields = $ob->GetFields();
 print_r($arFields);
}

but it is also possible through the component, after specifying the filter by property before the component

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question