With a slight alteration of your database, you can easily accomodate
multiple levels of categories like so:

table structure:
cat_id (auto number field)
cat_name (name, self-explanatory)
cat_childof ("child" of the cat_id field, see example below)

DATA
----------------
1       Picture Frame   0
2       Wooden Frame    1
3       Plastic Frame   1

or

DATA
----------------
1       Equipment       0
2       Earth Moving Equipment  1
3       Bulldozers      2

I use this structure both for categories and for "pages" (when a client
wants the ability to nest pages under pages).


<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Mike | NZSolutions Ltd [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 15, 2006 6:04 PM
To: CF-Talk
Subject: Category/sub-categories

Hi guys,

For a shopping cart app I created last year, I had one level of categories
eg. category/product

Now, I wish to expand on that and include 1 more level eg.
category/subcategory/product

A particular subcategory may apply to more than one category eg. winter
2006/accessories, spring 2006/accessories

Should I be looking at 2 different tables eg. tblCategory, tblSubCategory
and using joining tables to the products table.

Or should I have one category table with one joining table and use a nest
hierarchy system. I did a very simple nested hierarchy scheme last year for
an app which did have its benefits in terms of unlimited levels.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229663
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to