Answer the question
In order to leave comments, you need to log in
What is the best way to implement a filter with a huge number of products by properties?
The site has one category with 10k products linked. There is also a filter by product properties.
To display properties, you need to check that all 10k products have it, and the properties themselves are in another table through a many-to-many relationship, that is, we first need to select these 10k products from this category, and search for all properties using it through whereIn([1, 2, 3, ..., 9999, 10000])
Question - is it possible to somehow shorten this whereIn query, or is this normal practice? And how is it generally better to implement a filter with a huge number of products by properties.
3 tables:
products:
id, field1, field2, ...
options:
id, field1, field2, ...
products_options:
product_id, option_id
Where products_options is a many-to-many linking table between the products and options table.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question