close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Database structure advice sought

Thread began 8/17/2014 11:57 am by Patrice | Last modified 8/18/2014 11:53 am by Patrice | 363 views | 2 replies |

Patrice

Database structure advice sought

For all the mysql gurus who may have time to look at this, most appreciated.

I need to build tables/records to cover a number of contingencies and I'm trying to get my brain wrapped around it. I've attached a screenshot of what the client wants as the end result (currently being served as a pdf).

Tables that I assume I'll need:
Gender (M/F/U)
Size type (waist, chest, etc)
Measurements (30"-37")

Then the tables that join these three:
Women's
Women's Lengths
Men's
Men's Lengths

So Women's would include
womens_ID
gender_ID
size_type_ID
measurement_ID
womens_ ?? fuzzy here… Women's (name of group?)

Mens' -- repeat with
mens_ID etc.

Does this make sense? Or am I missing something. And I'm not sure yet how I can lay it out on the page to match up the grid currently being used.
Any pointers most appreciated.

Sign in to reply to this post

CraigRBeta Tester

I am guessing you are setting up a clothing store, selling mens/womens/unisex? clothing

If this is the case, I think your table structure seems too complicated.

Based on your image, I’m not sure where the unisex fits in, but here is a simple structure, which allows each item to have several sizes available, based on the data in your table.

Have a table for items
Have a table for sizes
Have a table for item sizes

tblitems contains the product information
tblsizes contains all of the size information
tblitemsize is the linking table so you can create a many-many relationship.

On this basis, any item can potentially have any size, but you can use logic in your web pages admin if desired to restrict options, so you cannot associate womens sizes with mens clothing for example.

Eg you could add a M/F field to the sizes table

I added some dummy data to the basic table layout

CREATE TABLE IF NOT EXISTS `tblitems` (
`ItemID` int(11) DEFAULT NULL,
`ItemDescription` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;



INSERT INTO `tblitems` (`ItemID`, `ItemDescription`) VALUES
(1, 'Mens Shirt'),
(2, 'Ladies Trousers'),
(3, 'Ladies Blouse');

CREATE TABLE IF NOT EXISTS `tblsizes` (
`SIzeID` int(11) DEFAULT NULL,
`SizeDescription` varchar(255) DEFAULT NULL,
`Bust/Chest` varchar(255) DEFAULT NULL,
`Waist` varchar(255) DEFAULT NULL,
`HipSeat/Sleeve` varchar(255) DEFAULT NULL,
`Inseam` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


INSERT INTO `tblsizes` (`SIzeID`, `SizeDescription`, `BustChest`, `Waist`, `HipSeatSleeve`, `Inseam`) VALUES
(1, 'XS 2-4', '30"-33"', '23"-25"', '33"-35"', '30"'),
(2, 'S 4-6', '33"-35"', '25"-27"', '35"-37"', '30.5"'),
(3, 'M 6-8', '35"-37"', '27"-29"', '37"-40"', '31"'),
(4, 'L 10-12', '37"-40"', '29"-32"', '40"-43"', '31.5"'),
(5, 'XL 14-16', '40"-45"', '32"-35"', '43"-46"', '32"'),
(6, 'S Petite', '-', '-', '35"-37"', '28.5"'),
(7, 'S Long', '-', '-', '35"-37"', '32.5"'),
(8, 'M Petite', '-', '-', '37"-40"', '29"'),
(9, 'M Long', '-', '-', '37"-40"', '33"'),
(10, 'L Petite', '-', '-', '40"-43"', '29.5"'),
(11, 'L Long', '-', '-', '40"-43"', '33.5"'),
(12, 'S', '34"-37"', '28"-30"', '32"-33"', '31.5"'),
(13, 'M', '37"-40"', '32"-34"', '33"-34"', '32"'),
(14, 'L', '40"-45"', '24"-36"', '34"-35"', '32.5"'),
(15, 'XL', '45"-49"', '36"-38"', '35"-36"', '33"'),
(16, 'XXL', '49"-53"', '38"-40"', '36"-38"', '33.5"'),
(17, 'M Short', '-', '-', '32"-34"', '30"'),
(18, 'M Long', '-', '-', '32"-34"', '34"'),
(19, 'L Short', '-', '-', '34"-36"', '30.5"'),
(20, 'L Long', '-', '-', '34"-36"', '34.5"'),
(21, 'XL Short', '-', '-', '36"-38"', '31"'),
(22, 'XL Long', '-', '-', '36"-38"', '31.5"');

CREATE TABLE IF NOT EXISTS `tblitemsize` (
`ItemSizeID` int(11) DEFAULT NULL,
`ItemID` int(11) DEFAULT NULL,
`SizeID` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


INSERT INTO `tblitemsize` (`ItemSizeID`, `ItemID`, `SizeID`) VALUES
(1, 1, 12),
(2, 1, 13),
(3, 1, 15),
(4, 2, 6),
(5, 2, 7),
(6, 2, 10),
(7, 3, 1),
(8, 3, 2),
(9, 3, 4);



So, to retrieve all of the available sizes for item 1, the mens shirt
SELECT tblitems.ItemID, tblitems.ItemDescription, tblsizes.SizeDescription, tblsizes.BustChest, tblsizes.Waist, tblsizes.HipSeatSleeve, tblsizes.Inseam
FROM tblitems INNER JOIN tblitemsize ON tblitems.ItemID = tblitemsize.ItemID INNER JOIN tblsizes ON tblitemsize.SizeID = tblsizes.SIzeID
WHERE tblitems.ItemID=1;



Hope this helps

Sign in to reply to this post

Patrice

Thanks for taking so much time with the answer, CraigR.
I am using PowerStore for a clothing line. Yes, I didn't show all the sizes such as Unisex in my question.
I will read over all that you've shared and hopefully I'll understand enough to create the size charts as in my posted image.

I may not have been clear though. I don't need to show all the shirts in a size. I just need to show what the measurements are on a size, i.e., Mens Length XXL has an inseam of 37", etc.

"So, to retrieve all of the available sizes for item 1, the mens shirt"

The image I posted is what I am trying to create so client can change values themselves as they need to. The cart itself can show the sizes for the product. This chart is separate from the cart as a reference point so folks know what size is best for them based on measurements.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...