apparatus Posted August 7, 2009 Share Posted August 7, 2009 I'm making a web shop using PHP and MySQL. I don't know if this is the right forum for this question, but here it goes. One thing I'm trying to do is flexible category management, meaning that product categories are semi-hierarchical, in the following manner. Let's say my web shop would be selling shoes. Imagine different kinds of categories: general types and their sub-types (shoes, boots, hiking boots, sneakers, sports shoes), manufacturer names (Nike, Adidas etc.) and names of product series (Air, Samba etc.). From this, several different hierarchies could be created: -Sorted by general type (boots / sneakers etc.), where brand names and sub-types would appear as sub-categories -Sorted by shoe sup-type (hiking boots), where brand names would appear as sub-categories -Sorted by manufacturer name (Adidas, Nike), where general types would appear as sub-categories I want to try not hard-coding a category structure or hierarchy, instead I want to enable the shop admin to make all these decisions: how many category levels there will be, what categories are linked, whether these links are one-way (e.g. Nike -> Air) or two-way (Sneakers -> Nike, Nike -> Sneakers) etc. I'm not really sure how to achieve this. Right now I have two database tables: one for categories (id, name, description) and one for category bindings (id, parent_id, child_id). I realize I will need more information to be stored in the database. Is this doable at all or should I rather stick with a more traditional approach to categories? Maybe I should try to have manufacturer names and product series as hierarchical categories, and general types and sub-types as "tags"? Am I overthinking this? Quote Link to comment Share on other sites More sharing options...
dreamwest Posted August 7, 2009 Share Posted August 7, 2009 RewriteRule ^([^/\.]+)/(.*)/(.*).html cats.php?type=$1&subcat=$2&maker=$3 http://site.com/shoes/nike/air or http://site.com/shirts/shirt/maker here etc... Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted August 7, 2009 Share Posted August 7, 2009 Sounds like you want to work with hierarchical data. You might find the following thread of use http://www.phpfreaks.com/forums/index.php/topic,263174.0.html edit Hmmm semi hierarchical yikes nvm that can be tough Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.