close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Product Options implementation

Thread began 7/25/2010 3:34 pm by victor405909 | Last modified 9/15/2010 2:14 pm by CraigR | 2287 views | 26 replies |


Product Options implementation

I have database set up and products from db displayed on details page.

I want to add options of color and sizes for clothing on this details page but I am unsure how to achieve this.

Does anyone know how to go about this?

Sign in to reply to this post

Eric Mittman

You will first need to come up with a set way that you would like the options to work out in regards to the organization in your db and how and when you would like to manage these options.

Product options can be very simple or they can be very complex. So the first thing is coming up with a strategy for how you would like it to all work, then once you have that down you can begin crafting the pages that will help you manage them. It will be up to you to come up with the parts for this, if you need any help in using DataAssist to accomplish any of the objectives let us know and we will help with what we can.

Sign in to reply to this post


I am working on a fashion site.

So I need to incorporate appropriate options to be displayed on details page for a particular category.

E.g. Option for men would be SHOE SIZE e.g 6, 6.5, 7, 7.5, 8 etc

JEANS would have 2 options to be selected:
Length: 34, 32, 30
waist: 30, 32 , 34, 35, 36 etc

So far I have a table "productoptions" in db with following fields of ProductOptionsID(integer), ProductID(integer), OptionID(integer), OptionGroupID(integer)
and OptionPriceIncrement(double). Which i'm not sure is correct.

It looks like this can get very complicated so require me to do some extra reading what I want to know is how you would approach this task.

I will need a visitor to be able to select option for a product on details page detail.php

I may need to combine one or more options for one given product

I may need different options to appear on details page determined by item selected by visitor.

I appreciate any help you can give please include key elements e.g. I think a URL Parameter id may help in displaying the options but I am unsure.

Thanks for your help!

Sign in to reply to this post

CraigRBeta Tester

for different options on the product details page, you would need each option type to be stored in its own table, with a foreign key for the product id. the url paramter which filters the product recordset, so that only 1 product is shown, would also be utilised here, so that each recordset of options would be filtered to show only the options relevant to the chosen product

this will allow you to select as many options you need.

you also need to decide what affects the price

the database required is not particularly complex, but does require some planning.

i would be tempted to try one option first and get it working to your satisfaction, before attempting several

Sign in to reply to this post


Thank you very much!

This should give me a good start.

Sign in to reply to this post


I have been having a bit of trouble trying to get the right sql statement to bring up correct options for specific products.

I am working on a fashion site. When a product id is selected I want the page to filter to display the correct options from the recordset.

Can someone please advised me.

So far I have products and options in their own tables:

Products (table)
ProductID int(11) auto_increment primary key,
ProductName varchar(50)

TShirt (table) option
ts_id int(11) auto_increment primary key,
tsSIZE varchar(20) [this is for actual size e.g. small, medium, large, x large.]
ProductID int(11) [this is foreign key for product ids]

DressSize (table) option
ds_id int(11) auto_increment primary key,
drSIZE varchar(20) [this is for actual size e.g. size 4, size 6, size 8, size 10.]
ProductID int(11) [this is foreign key for product ids]

Sign in to reply to this post

CraigRBeta Tester

you don't really need a separate table for each product type
Take size for instance.
In a simple two table relationship, your tables could be like this…
products table
ProductID (PK)

sizes table
SizeID (PK)
ProductID (FK)

On your products detail page, (filtered by your URL parameter), the size options available in your dropdown list could be obtained as follows…

SELECT SizeID, SizeDescription FROM sizes WHERE product ID = x (where x is your URL parameter)

So, if t shirt is productID 1 and dress is productID 2

Sizes table would be like this..

Size ID ProductID SizeDescription

1 1 small
2 1 medium
3 1 large
4 1 x large
5 2 size 4
6 2 size 6
7 2 size 8


Sign in to reply to this post


Thanks that worked!

Do know how I would increase a price due to an option
e.g. xx large (extra material may mean cost a little more)


Sign in to reply to this post

CraigRBeta Tester

there are lots of possible ways to do this, depending how many product option combinations you require

for example, for each SKU, is price dependent solely on size, for all items, or do other options have an effect ?

eg is a red t shirt in xxl the same price as a black one in xxl

you could have a separate price table with the combination of option id's having the unique price for that particular combination.

if you are confident that price is based on size only, you could even add it to your size table

Also, if you are considering different prices for the same SKU, you may need to show 'price from' or a price range.

Sign in to reply to this post


It will be based on size only although I would like to learn any other ways to broaden my knowledge.

Any help is most welcomed.

Thank you for all your help.

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





Ease of use


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...