views:

36

answers:

1

Hey there,

I'm trying to get my mind going on a project to my college, but I can't seem to get it right. I'm can't fit my requirements in my models. Maybe someone that has worked on a store can help me out.

Let's say we have our so overused e-commerce model.

Category has many Products (I never understood where the SKU fits in here) Ex: T-Shirts -> Summer 2010 Happy New Year

Products can have many specifications based on what kind of product we are dealing with.

So Product has many specification that has many specification_items. Ex: Summer 2010 P White Summer 2010 XXX Green

Edit: Or this can be called variantions, maybe its a better name.

Etc.. each of that is in fact a SKU, right? which has a stock quantity, price, weight etc.

How do I work this relationships out?

Thanks! LiZarD

A: 

I have the same problem as the first commenter, however i'll try to translate your description into UML terms(there is object modeling tag assigned to this question). Category is a class with one to many associatio towards Product class. Product class may include all the attributes you mentioned in SKU or maybe, if needed inherit them from separate SKU class or even realize SKU interface. Than you have one to one association between Product class and Specification class. Specification class will be composed of Specification_item class instances. This pretty much covers what you have described.

Gabriel Ščerbák