Answer the question
In order to leave comments, you need to log in
How to make a filter with complex logic?
Hi all!
I'm trying to display the minimum value of the property "PROPERTY_SIZE" (number) of all elements in a section. I actually get the value, but the logic doesn't work that way. I make a selection:
$arOrder = array("sort" => "asc");
$arFilter = array("IBLOCK_ID" => $arSection["IBLOCK_ID"], "SECTION_ID" => $arSection["ID"], "GLOBAL_ACTIVE" => "Y", "ACTIVE" => "Y", "INCLUDE_SUBSECTIONS" => "Y", array(
"LOGIC" => "OR",
array("PROPERTY_DESTINATION_VALUE" => "TOP", "PROPERTY_DESTINATION_VALUE" => "MIDDLE", "PROPERTY_DESTINATION_VALUE" => "BOTTOM"),
),
"!PROPERTY_SIZE" => false
);
$arSelect = array("IBLOCK_ID", "ID", "NAME", "PROPERTY_SIZE");
$res = CIBlockElement::GetList($arOrder, $arFilter, false, array("nTopCount" => 1), $arSelect);
if ($ob = $res->Fetch())
$arSection["MIN_SIZE"] = $ob["PROPERTY_SIZE_VALUE"];
Answer the question
In order to leave comments, you need to log in
Most likely, Bitrix will no longer be able to handle such logic and you need to access SQL and form a direct query in the database. Or, you can make an intermediate table / infoblock / highloadblock and already search there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question