How to create advanced product filter for multiple categories?

Viewed 20

I want to create product filter for multiple categories:

For ex.: mobile phones - parameters: color, RAM, Memory PC - paramaters: Procesor, Graphic card, RAM, Memory ...

And I do not know how to set up database tables for this purpose. My idea is to create two tables:

1. Items
Id | Item_Name   | Cat_Id | Option_1   | Option_2 | ...
1  | Samsung S20 | 1      | Blue       | 16GB     | ...
2  | Acer        | 2      | Intel Core | Nvidia   | ...

2. Categories:
Id | Cat_Name | Option_1 | Option_2 | ...
1  | mobiles  | color    | RAM      | ...
2  | PC       | procesor | graphic  | ...

Then I will have filter

Category:

  • mobiles
  • PC

If I choose mobiles it will show filters:

Color (option_1):

  • blue

RAM (option_2):

  • 16GB

Is this good way how to do db structure for this purpose? Thank you

0 Answers
Related