If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Review Product/Size/Color/Price Ecommerce Database...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-10, 09:17
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Post Review Product/Size/Color/Price Ecommerce Database...

Hello...

Hello guys... I´m designing an ecommerce database...

* A product can have several sizes and several colors
* Each combination of products´s size/color must have a specific price

So, I can have a Product X with sizes: A,B,C and colors: Green,Black and White

And each combination have its price...

It´s implemented in Amazon, one example here : Amazon LINK Sample

What I´ve done so far: Review Product/Size/Color/Price Ecommerce Database...-product.png

What you guys think? Suggestions?

Thanks
Reply With Quote
  #2 (permalink)  
Old 10-26-10, 09:49
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Are all products available in all sizes and all colours?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #3 (permalink)  
Old 10-26-10, 09:53
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Quote:
Originally Posted by pootle flump View Post
Are all products available in all sizes and all colours?
Hi...

No... It can be different...
In some cases the product has no color or size at all...

Thanks
Reply With Quote
  #4 (permalink)  
Old 10-26-10, 10:00
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Ta.

There are these two rows in the database:
Code:
ProductSize
Id     ProductFk     SizeFk
1      1             1

ColorProduct
Id     ProductFk     ColorFk
1000   1000          1
Please could you explain if it is valid for me to enter 1 for SizeProductFk and 1000 for ColorProductFk? If it is not, then what is there to stop me?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #5 (permalink)  
Old 10-26-10, 10:35
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Substancesundonte

Quote:
Originally Posted by pootle flump View Post
Ta.

There are these two rows in the database:
Code:
ProductSize
Id     ProductFk     SizeFk
1      1             1

ColorProduct
Id     ProductFk     ColorFk
1000   1000          1
Please could you explain if it is valid for me to enter 1 for SizeProductFk and 1000 for ColorProductFk? If it is not, then what is there to stop me?
If there is a Product with ID 1000 and 1, yes should be valid...
Reply With Quote
  #6 (permalink)  
Old 10-26-10, 10:51
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Just to be sure you understand what I am saying:
It is correct to have a row in ProductPrice that references a row in ProductSize for a product of ID 1 and that also references a row in ProductColor for a product of ID 1000?

In other words, a row in ProductPrice can reference one product for the size and another product for the coloru?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #7 (permalink)  
Old 10-26-10, 10:56
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Quote:
Originally Posted by pootle flump View Post
Just to be sure you understand what I am saying:
It is correct to have a row in ProductPrice that references a row in ProductSize for a product of ID 1 and that also references a row in ProductColor for a product of ID 1000?

In other words, a row in ProductPrice can reference one product for the size and another product for the coloru?
I understood now...
No, It should never happen ...
Reply With Quote
  #8 (permalink)  
Old 10-26-10, 11:01
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
"Should", "could" and "oh sh*t, it has" are all very different beasties.
So - any ideas how to stop it happening? I'm talking declaratively, by properly constraining the database, not "ah, the app will check....".
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #9 (permalink)  
Old 10-26-10, 11:11
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Quote:
Originally Posted by pootle flump View Post
"Should", "could" and "oh sh*t, it has" are all very different beasties.
So - any ideas how to stop it happening? I'm talking declaratively, by properly constraining the database, not "ah, the app will check....".
I got your point, but I found other problens that I must fix before setting constraints...

1 - Analysing my design how can I have one ProductPrice without color AND without size ?
2 - What you think change my design to something like that :
  • A Product table that will contain a record for every combination of item, size, and colour, with a unique SKU and Price for each.
  • A Size table that normalizes out the common sizes Products may have. Product has a foreign key to this table.
  • A Colour table, as above.

Thanks
Reply With Quote
  #10 (permalink)  
Old 10-26-10, 11:54
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
either create an entry in the size table for "all sizes"
OR
carry a default price at the product level, if no price quoted at the colour/size entries then use the price at product level.

the second approach requires additional programming input and development to make sure you pick the right price. it also means that the users have to be more careful about where and how they manipulate the price element. it would be all to easy adjust the wrong price, not appreciating that there may be multiple prices for that product line
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #11 (permalink)  
Old 10-26-10, 12:12
pauljame pauljame is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Quote:
Originally Posted by healdem View Post
either create an entry in the size table for "all sizes"
OR
carry a default price at the product level, if no price quoted at the colour/size entries then use the price at product level.

the second approach requires additional programming input and development to make sure you pick the right price. it also means that the users have to be more careful about where and how they manipulate the price element. it would be all to easy adjust the wrong price, not appreciating that there may be multiple prices for that product line
Thanks!
So, You think I should stay with that database design (Original post) ?
Reply With Quote
  #12 (permalink)  
Old 10-26-10, 13:29
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
No
Im saying you need to analyse your business requirements and develop a strategy that allows you to have products, with different colours, different sizes, which seemingly also have different prices. how you do that is up to you. sadly in the development world theres often many answers and more than one that is right, and more than one that is workable.

the issue is how you design your schema such that it supports the business requirement.

its arguable that the real issue is how you define the product
is the product, say, a specific style / cut / fabric of pair of trousers and then sub classified by colour and size,
or
is the product a pair of chinos in navy blue waist 32, leg 29, with belt, and say wasit 24 is another product.
to me thats the nub of your problem.
persoanlly I'd expedct it to be the latter, I'd be surprised if any retailing outlet saw a product as a pair of Chinos, and then dropped down a level to sub classify them.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Tags
ecommerce

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On