A
A
Alexander2021-01-12 15:32:11
1C-Bitrix
Alexander, 2021-01-12 15:32:11

How to filter products by property?

There are infoblock products, they have power properties, for example 20, 30, 50, 100
. 30 and 100. How to enter data into the request?

I get data via GetList

$arSelect = array(
        "ID",
        "IBLOCK_ID",
        "NAME",
        "DETAIL_PICTURE",
        "DATE_ACTIVE_FROM",
        "PROPERTY_PERFOMANCE",
        "PROPERTY_WEIGHT_NETTO",
        "PROPERTY_LAMP_TYPE",
        "CATALOG_GROUP_3"
    );
    $arFilter = array(
        "IBLOCK_ID" => 37,
        "ACTIVE_DATE" => "Y",
        "ACTIVE" => "Y",
        ">=PROPERTY_PERFOMANCE" => array($request['power'])
    );
    $res = CIBlockElement::GetList(array(), $arFilter, false, array("nPageSize" => 50), $arSelect);

It should be filtered by PROPERTY_PERFOMANCE, which comes through the request.

here I filter by the property more than "power"
">=PROPERTY_PERFOMANCE" => array($request['power'])


The gag is that if a small (30) power came and a large one (70), then it outputs a small one (30) and the next one (30)
And you need 30 and 100. I don’t understand how to adjust the sample?

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