A
A
Alexander2017-05-08 21:40:58
1C-Bitrix
Alexander, 2017-05-08 21:40:58

How to filter a directory by the value of a highload type field?

There is a directory with the BREND property, type directory (highload).
A catalog is displayed on the page, how to filter it by the value of the BREND property, so that products of the same brand are displayed.
If the property value were a list, then it would be done like this:
global $arrFilter;
$arrFilter["PROPERTY_BRAND_VALUE"] = $_GET['BRAND_ID'];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlaka, 2017-05-09
@kascor

You need to select by XML_ID.
Let's look inside.
Database:
HL-block. I don't know why it's named the same (two ID fields). It can be renamed, but this is what the system does and the standard equipment is important to us now):
Well, our request:

\Bitrix\Main\Loader::includeModule( 'highloadblock' );
\Bitrix\Main\Loader::includeModule( 'iblock' );

$el_Filter= [
        'IBLOCK_ID' => 5,
        'INCLUDE_SUBSECTIONS' => 'Y', 
        'PROPERTY_BRAND' => 46361
];

$el_Nav= [ 'nTopCount' => 10 ];

$el_Select= [ 'IBLOCK_ID', 'ID', 'NAME', 'PROPERTY_BRAND' ];

$el_res= CIBlockElement::GetList( false, $el_Filter, false, $el_Nav, $el_Select );
while ( $el_arr= $el_res->Fetch() ) {
  ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question