Answer the question
In order to leave comments, you need to log in
How to select such elements through GetList() that satisfy all filters at the same time?
Hello. There is an array $search of the type ["errors", "x23", "280", "pt3009"], you need to select those elements in which all these searched values exist simultaneously. Thus, array("=PROPERTY_TAGS" => $search) selects all elements that contain at least one of the searched values. Is it possible by means of GetList(). As I understand it, the complex logic LOGIC => AND is not that?! Tried to do like this:
[
["LOGIC" => "AND"],
["PROPERTY_TAGS" => "ошибки"],
["PROPERTY_TAGS" => "х23"],
["PROPERTY_TAGS" => "280"],
["PROPERTY_TAGS" => "пт3009"],
]
Answer the question
In order to leave comments, you need to log in
foreach($search as $s) {
$arSearch[] = array("ID" => CIBlockElement::SubQuery("ID", array("IBLOCK_ID" => 118, "PROPERTY_TAGS" => $s)));
}
$arSearch["PROPERTY_MODELS_AND_PROD_ID"] = $arResult["MODEL_OR_PROD"];
$GLOBALS['tagsFilter'] = $arSearch;
$query = "SELECT IBLOCK_ELEMENT_ID, count(VALUE) cnt from b_iblock_element_prop_m118 where IBLOCK_PROPERTY_ID='2510' AND VALUE in ('".implode("','",$search)."') group by IBLOCK_ELEMENT_ID having cnt=".count($search);
$result = $DB->Query($query);
while($arElement = $result->GetNext()) {
$arSearch[] = $arElement['IBLOCK_ELEMENT_ID'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question