Jump to content

Flexible, cross-linked categories - how to do it?


apparatus

Recommended Posts

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?

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.