Welcome Guest, Not a member yet? Register   Sign In
Products that have attributes with attributes
#1

[eluser]packetfox[/eluser]
Hello Folks and happy new years,

I am looking for advise on the following Product -> Attribute Problem and how to come up with a sound Database Design:

For each Product in my Database one can assign different attributes (or choices / options)

Example Products:
1. a Hat, no available attributes. Its just a hat.
2. a Shirt, with available attributes
Sizes: Choose from L,XL,XXL
Buttons: Choose Number of Buttons (i.e 1-5) and then for each Button the desired Color;
3. another Shirt, with attributes
Colors: Choose from red, blue or green

And that is the Problem. Not only can the Number of Buttons available for a Product vary, but then they also sort of have attributes themselves, in this case color. Attributes with Attributes.. Undecided

Id be thankful for any nudge in the right direction!
#2

[eluser]mi6crazyheart[/eluser]
I think, u can make table for each stuff. Like.. make table HAT where u can store all HAT's information. Similarly, u can make a table for SHIRT where u can store all the info of Shirts only. In this way, u can easily manage each & every stuff more properly.
#3

[eluser]smilie[/eluser]
Hi,

I hope that shirt > button > number > colors is only an example as I would personally never wear a shirt with 10 buttons in different colors :-)

Anyway, regarding your DB problem;
How about using 'parent' for each attribute? For as long as attribute has parent - you 'dig' more in DB. Once it has no more parents, you are at the top level?

For example:
button (no parent)
color (parent: button, shirt, pants);
size (parent: shirt, pants);
number (parent: *all*);

and so on?

Just a thought...

Cheers,
Smilie




Theme © iAndrew 2016 - Forum software by © MyBB