Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 8th, 2005, 07:11 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
clothing ecommerce mysql php

hi,

I'm developing a php based CMS for an ecommerce store and it will be selling clothes (amongst other things) and I'd like a bit of insight from other developers into how to approach the issue of stock levels of different colours and of different sizes of the same garment.

At the moment I've just got a single table in my DB called 'products' - which has the following structure:

product_id,
product_category_id,
product_type_id,
product_ref,
product_name,
product_desc,
product_format,
product_sizes,
product_colours,
product_price,
product_quantity


When a product is added into the system, the admin adds sizes, such as 'small, medium, large' and colours 'red, green, blue' for the product, but there's no relationship between them. What I really need is to have the following (I think):

product
>> colours
>>>> colour 1
>>>>>>> sizes
>>>>>>>>> size A
>>>>>>>>>>> quantity

I was originally going to have a table for each (colours, sizes etc), but that was becomming quite a monster to administer, so (I think) I would prefer to do it all with php. I was thinking of doing something along the lines of:

$sVariations = "Red-Extra Small=50,Small=50,Medium=10,Large=25,Extra Large=25;Green-Small=25,Medium,15";

and then using php to split it up like so:

[PHPNET]<?php

$sVariations = "Red-Extra Small=50,Small=50,Medium=10,Large=25,Extra Large=25;Green-Small=25,Medium,15";

$aVariations = split(";", $sVariations);

$aColours = split("-", $aVariations[0]);

$aSizes = split(",", $aColours[1]);

print_r ($aVariations);

print_r ($aColours);

print_r ($aSizes);

?>[/PHPNET]

what does anyone think of either approach, any ideas on which I should go for, or any suggestions on another approach I haven't seen.

Many thanks,

Jon

Reply With Quote
  #2  
Old June 8th, 2005, 08:14 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
I have moved this thread to Database development.

Although you're mentioning MySQL and PHP, the question seems more about confirming your database structure than solving an error in your PHP code.

Reply With Quote
  #3  
Old June 8th, 2005, 08:17 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
I think seperate tables for sizes and colours isn't a bad idea...

If you consider the fact that you might want to know how many small white shirts you have, it's a simple SELECT statement away.
Or tell me how many green shirts [of any size] you have...

Is this for your personal development as a programmer, or is it for a full retail store?
If it's for proper retail, I would advise a proper structure, well planned.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > clothing ecommerce mysql php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway