D
D
DeeUs2019-10-30 09:19:50
1C-Bitrix
DeeUs, 2019-10-30 09:19:50

How to filter infoblock elements in catalog.section?

Hello!
How to filter infoblock elements in catalog.section?
It is necessary to make sure that the elements are not displayed if all three property values ​​are empty (property type is "Number").
tried it in different ways:

$GLOBALS['arrFilterС'] = array(
         "!=PROPERTY_SKLAD_1" => '',
         "!=PROPERTY_SKLAD_2" => '', 
         "!=PROPERTY_SKLAD_3" => ''
);
$GLOBALS['arrFilterС'] = array(
        array(
                "LOGIC" => "OR",
                array("!=PROPERTY_SKLAD_1" => ''),
                array("!=PROPERTY_SKLAD_2" => ''),
                array("!=PROPERTY_SKLAD_3" => ''),
            ),
);
/*
так же пробовал свойства прописывать так:
PROPERTY_SKLAD_1_VALUE
DISPLAY_PROPERTY_SKLAD_1_VALUE
DISPLAY_PROPERTY_SKLAD_1
так же пробовал в значении использовать '', 0, '0'
перед свойством пробовал писать >
так же вместо $GLOBALS['arrFilterС']  пробовал просто писать $arrFilterС
*/

in component connection:
"FILTER_NAME" => 'arrFilterC',
"USE_FILTER" => 'Y',

What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Kirshin, 2019-10-30
@meowto16

They like if are not set, then NULL. Try to output var_dump'om in a template of a component and to look at their values.
Before connecting the component, write this:

global $arFilter;
$arFilter = [
  "PROPERTY_SKLAD_1" => !NULL,
  "PROPERTY_SKLAD_2" => !NULL,
  "PROPERTY_SKLAD_3" => !NULL,
]

Y
Yaroslav Alexandrov, 2019-10-30
@alexyarik

If the values ​​are numeric then you can do this:

global $arrFilter;
$arrFilter = [
  ">PROPERTY_BLOG_POST_ID" => 0,
  ">PROPERTY_BLOG_COMMENTS_CNT" => 0,
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question