[thelist] DB question: product attributes

Erik Mattheis gozz at gozz.com
Thu Apr 25 21:20:01 CDT 2002


I have a bunch of products, most of which have attributes. The
attributes change nothing about the product other than that products
with a particular combination of attributes may be temporarily out of
stock.

I set up the DB as a products table, a product attributes table and a
product attributes lookup table ... this seemed the right thing to do
as there's few products, few attribute names and a whole lot of
attribute values:

Product    attribute_name  attribute_value
T-shirt    color           green
T-shirt    size            XL
steak      size            20 oz
steak      cooked          well-done
potatoes   color           red
potatoes   cooked          french-fried

I've just been getting drool on my keyboard past that point ... I
want to avoid the CMS giving my client an option to make a well-done
russet T-shirt available for purchase on her site and at the same
time have all configurations of T-shirts have the same product_id, as
well as all steaks, etc.

My thinking now is that I should scrap the attributes lookup table
and just have an "available configurations" table and a "valid
attribute name" lookup table ...

Any way I dice it up, it seems more complex than it should be ... the
simplest solution I can think of is to just put several "paired"
columns in the product table: attribute1_name, attribute1_value,
attribute2_name ... etc. That seems too much of a brute force
solution.

Sorry for such a general question, but I'm hoping someone can reveal
a simple and eloquent way of going about this.

--

__________________________________________
- Erik Mattheis

(612) 377 2272
http://goZz.com/

__________________________________________



More information about the thelist mailing list