First of all, I couldn't find a better name for the topic's title, if you can, please edit the title.
I got the following tables:
products
- id
- name
- desc
- image
categories
- id
- name
- parent_id
products2categories
- id
- product_id
- category_id
Let's say that I got this information in the tables:
products
- 102
- Pilot Pen Blue
- Some pen desc blah blah blah
- Some image location
categories
- 10 -11
- Pens -Pilot Pens
- None -10
products2categories
- 1
- 102
- 11 -> ofcourse if it's related to category 11, it also related to category 10
Looking at the demo information, we can see that we got "Pilot Pen Blue" which is related to category number 11 (Pilot Pens
), but since "Pilot Pens" is a "child" of "Pens" Whenever the user will look for ALL pens available, I would like to show the Pilot pen aswell.
How do I make that happen?
If you guys have any other good database structure for Catalog, please feel free to suggest!