There is a site Elessi , if someone knows, tell me how to make such a filter a product. I wrote the structure of the site. Only the database and the output function do not know how to do it correctly. If anyone has a suggestion? It will suit me if you just drop a link to some source. Because already 6 day racking my head. I do not know what to think ... If a product has one color or size, then everything is clear. But if in one product, but it has three colors, I do not know what to do anymore. Thank you in advance!

PS: All I want to know: How to arrange a database with filters and how to create a SQL query

    1 answer 1

    How to make a database with filters

    Like any other database. You break object into attributes and save in corresponding tables. All "filters" are queried. If several values ​​are available, create a separate table and join it as necessary.

    How to create a SQL query.

    In your case, it could be something like SELECT * FROM goods WHERE color IN ("Red", "Blud", "White") AND price <500. I think, as an example, to understand the principle of constructing such queries. More specifically difficult to say. I did not see what's going on in your database.

    Just in case, I’ll clarify that an object with information about all of your filters should go down to the DAO level and is already parsed there. No need to generate hundreds of methods for each combination