Good afternoon, hashcoders. The problem is this: you need to create a search for several parameters (for example, click on http://auto.ria.ua/). Who can suggest any materials, templates, etc.?
1 answer
I can tell you how I solved this problem. For example, we create four tables: products (id_prod, prod_name, etc.), prop_type (id_pt, pt_name), prop_val (id_pv, id_pt, pv_name) and filter_data (id_product, id_prop_type, id_prop_val).
With the first table, everything is clear. In the second we store the names of the filter groups (Brand, Model, etc.), in the third - the properties / values of each group (" Brand ": BMW , Audi , ZAZ . " Model " -> for BMW: 315 , X5 , Z3 ; for Audi: A1 , 100 ; for ZAZ: 1102 Tavria , 969 , Humpback ;) and so on). Well, in the fourth table we hold the "bundle" of product id -> filter group id -> id filter value. Link tables can be represented as follows:
When the user has selected the necessary parameters, we first select the product id ( id_products ) from the filter_data table by matching values and, accordingly, derive the product from the products table.
- very interesting, thanks! - Azwart