Magento - product attribute index and layered navigation

By default, Magento multi-level navigation logic works like OR - for example, the manufacturer Nike OR Reebok, the price is from 80 to 100 US dollars or from $ 100 to $ 120, etc.

However, there are some multiselective attributes that we want to filter using the AND logic - for example, I want to find a T-shirt with Blue AND Green color.

We have AND logic ... however, there is a problem because the Product Attribute index builds not simple products from a custom product, so when I filter Blue AND Red T-shirts, I get all custom T-shirts that have blue and red in any of the simple products, therefore:

T-shirt 1 (config) blue and red shirt (simple)

T-shirt 2 (config) blue shirt (simple) red shirt (simple)

I get both tshirt 1 and tshirt 2 in my results, but actually I just want tshirt 1.

Any thoughts?

+4
source share
1 answer

To get these results, your SQL query should look like this:

SELECT ... WHERE color="blue" AND color="red" // return Tshirt 1 (config) blue and red shirt (simple) AND Tshirt 2 (config) blue shirt (simple) red shirt (simple) 

but you want to get the result of this query:

 SELECT ... WHERE color="blue and red" // return: Tshirt 1 (config) blue and red shirt (simple) 
0
source

Source: https://habr.com/ru/post/1379302/


All Articles