Hi Everyone,
I am building an EC website for a customer and the project manager came with some strange ideas and I am struggling to actually implement what he sold to the client.
Here comes my main issue and a quick summary how the system is setup: product are inside categories, categories could be children of an another category. So the category is presented as a tree on the left sidebar of the website.
The user can browse any category, even non "leaf" category, if the user click on non leaf category a listing like that should be presented for exemple on a level 1 category (same apply to level 2 categories):
big category 1
category level ( 3 or 2 )
product 1
product 2
product 3
category level ( 3 or 2 )
The things should also have some paging and present on 5 product on each page. Plus the category should be ordered in same fashion they appear in the menu on left side ... my DB scheme is like this:
+-------------+ +-------------+
+ category + + product +
+-------------+ +-------------+
+ category_id + + product_id +
+ parent_id + + category_id +
+-------------+ +-------------+
I cannot really figure out how I should code the SQL to make sure the product appear in order they should(like ordering product and categories has menu).
Also I am concerned about the performance of the whole setup, if the user select a non "leaf" category I would have to search all the child category and make a big category IN ( id1, id2, id3 ) and I know by experience long IN statement don't perform well.
If someone have encountered same design/issue and have some advice how to make it I would be grateful.