A
A
Anna2021-03-02 19:51:09
1C-Bitrix
Anna, 2021-03-02 19:51:09

How to make a complex filter by several properties?

Good afternoon, colleagues! Recently, the question arose of finalizing the smart Bitrix filter. Essence - before the filter worked standardly according to logic AND.
Those. in the filter, as usual, it was possible to select a property, for example, there are properties of a product (what product, a frying pan, a saucepan, etc.), a handle (round, long), etc.
If the buyer chose a pan, and among the pans there is no product with the round handle property, then this property (round handle) becomes DISABLED in the filter (processing is carried out in the standard smart.filter component).
Now a task has appeared - there are 2 more properties, the material of the product and the material of the handle. The materials in these properties can match, and I wanted to combine the result for these two properties. Those. so that when choosing, for example, cast iron, so that cast-iron pans and pans with a cast-iron handle are also selected.
It was solved using the complex logic of the filter
"LOGIC" => "OR",
"=PROPERTY_MATERIAL_GOOD" => iron,
"=PROPERTY_MATERIAL_HANDLE" => iron.

Goods are filtered as they should, but checks for DISABLED of other properties are now not processed. Please tell me how to make the products filtered by both of these properties, but if there are no products that meet both of these properties (cast iron product, cast iron handle), for example, there are no such pans so that the product type property - pan becomes DISABLED.

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