Answer the question
In order to leave comments, you need to log in
Why does the exception in arrFilter not work?
Good afternoon, there is a condition:
if($_POST['SECTION_ID'] != 4){
$arrFilter["!SECTION_ID"][] = 4;
}
if($_POST['SECTION_ID'] != 27){
$arrFilter["!SECTION_ID"][] = 27;
}
if($_POST['SECTION_ID'] != 3){
$arrFilter["!SECTION_ID"][] = 3;
}
if($_POST['SECTION_ID'] != 2){
$arrFilter["!SECTION_ID"][] = 2;
}
if($_POST['SECTION_ID'] != 4){
$arrFilter["!SECTION_ID"] = 27;
}
if($_POST['SECTION_ID'] != 4){
$arrFilter[0]["!SECTION_ID"][] = 27;
}
if($_POST['SECTION_ID'] != 27){
$arrFilter[0]["!SECTION_ID"][] = 27;
}
if($_POST['SECTION_ID'] != 3){
$arrFilter[0]["!SECTION_ID"][] = 3;
}
if($_POST['SECTION_ID'] != 2){
$arrFilter[0]["!SECTION_ID"][] = 2;
}
Answer the question
In order to leave comments, you need to log in
The negation in the SECTION_ID filter will not work if the elements are bound to multiple sections, in case of filtering by an array of IDs.
> I found this option on the Bitrix forum:
Maybe they offered something like this:
if($_POST['SECTION_ID'] != 27){
$arrFilter[0]["!SECTION_ID"] = 27;
}
if($_POST['SECTION_ID'] != 3){
$arrFilter[1]["!SECTION_ID"] = 3;
}
?
Honestly, it's not clear what you are trying to achieve with this code. And the code itself is scary, sorry...
If you have such a construct in the if(cond1){} if(cond2){} code, you are most likely doing something wrong.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question