close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Product Options

Thread began 10/21/2009 10:14 am by eaddudley390229 | Last modified 3/11/2010 2:43 pm by Jason Byrnes | 4412 views | 7 replies |

eaddudley390229

Product Options

Hi I would like to know how to set up my mysql database for a dynamic site, for product options.

I have pepper sprays first is red then blue, green, and black.

I also have stun guns 100,000v $20.00, 200,000v $36.00 and 300,000v 45.00.

How should i set this up in the database what should the tables be called

Sign in to reply to this post

Jason ByrnesWebAssist

you will need 4 tables:
products - product information
optiongroups - a listing of option groups such as color or size or voltage
options - the names of the options such as red or 100,000v
productoptions - linking table to link the options to the products


products:
productID - Primary Key
productName
productDescription
productPrice - this will be a base price since some of your option will effect price.
etc....

optiongroups:
optiongroupID - Primary Key
optiongroupName

options:
optionID - Primary Key
optionOptiongroupID - Foreign Key Relation to optiongroups.optiongroupID
optionName

productoptions:
productoptionID - Primary Key
productoptionProductID - Foreign Key Relation to products.productID
productoptionOptiongroupID - Foreign Key Relation to optiongroups.optiongroupID
productoptionOptionID - Foreign Key Relation to options.optionID
productoptionPriceIncrement - Optional column. This will be used to add to the price. for example, your stun guns the base price will be stun $20.00 in the products table. the 200,000v option will be set to 16 (20 + 16 = $36.00)

Sign in to reply to this post

eaddudley390229

What should tables look like

Hey thanks for your reply. Just so I'll understand how the table should look like could you show me what each table should look like with the sample data
Stun Gun Model C, 100,000v $20.00, 200,000v $36.00 and 300,000v 45.00.

Sign in to reply to this post

Jason ByrnesWebAssist

see the attached text file.

Attached Files
sampleData.txt
Sign in to reply to this post

eaddudley390229

Thanks

Awesome!!! Thanks a lot I understand now. The only thing now is to ask how to add options field to the admin section for adding products to the site.

Sign in to reply to this post

Jason ByrnesWebAssist

this part is a fairly big undertaking.

First, lets think about the work flow and how the tables relate:

you have 3 pieces:
1-The OptionGroup

2-The Option Name

3-The Product

the Option Name relates to the option group

First you create an option Group, then add an option name to that group.

The option group and option name are completely separate from the product.

using the productoptions table, you can "assign" an option name to a product.

an option name can be assigned to multiple products, and effect the price differently on each because of the productoptionPriceIncrement column
-------


so onto creating the product insert:

1) you need to have a page to enter new Option groups, this is a simple page, with one form element on it:
Group Name:

use the Data Assist Insert Record behavior to insert the group name into the optiongroups.optiongroupName column.


2) You need another page to create option names. The option name needs to relate to the optiongroups table.

This page will have two form elements:
OptionGroup - Select List
OptionName - text Box


For the option group Select list, create a recordset:
rsOptionGroups:
SELECT * FROM optiongroups

set the OptionGroup select list to be dynamic, use the optiongroups.optiongroupID column for the value and the optiongroups.optiongroupName for the label.

The DataAssist Inssert Record server behavior will store the option group in the options.optionOptiongroupID column and the OptionName in the options.optionName

3) Then Use DataAssist to create pages for managing the product table. I would use the product detail page manage product options for the selected product.

You need to have a form with 4 elements:
OptionGroup - Select list
OptionName - Select List
PriceIncrement - Text Box
productID - hidden Form Element

create a recordset for the option groups:
rsOptionGroups:
SELECT * FROM optiongroups

set the OptionGroup select list to be dynamic, use the optiongroups.optiongroupID column for the value and the optiongroups.optiongroupName for the label.


Create a recordset for the option names:
rsOptionNames:
SELECT * FROM options


Here you need to use dynaic Dropdowns to populate the OptionName select list.

Use the Create Dynamic Array Server behavior, use the rsOptionNames recordset. set the parent ID to the optionOptiongroupID column. The child ID to the optionID column and the Child text to the optionName column

In design View, select the OptionGroup select list, on the Bindings Panel, click the plus button and select WA Dynamic Dropdowns -> Populate List From Array. use the OptionGroup as the parent list and the OptionName as the child list.


For the productID hidden Form Element, bind to the Product ID column from the WAProduct recordset.

you then need to add a DataAssist Insert record behavior to the page for the productoptions table.

Bind the productoptionOptiongroupID column to the OptionGroup select list.
The productoptionOptionID column to the OptionName Select List.
the productoptionPriceIncrement column to the PriceIncrement Text Box.
and the productoptionProductID column to the productID hidden Form Element.

Sign in to reply to this post

SaladoGuyBeta Tester

Linking options to the buy it now button?

We understand setting up the the database the way you described, but how do we implement the multi options in our webpage. In other words, How do we link the the multi options to the buy it now button.

We do have the super suite from webassist. Is there a tool that came with the super suite that we can use to implement this?

Sign in to reply to this post

Jason ByrnesWebAssist

you keep starting new threads asking this same question. please keep to one thread sao we can effectively help you,. If you continuously start new threads on the subject, we will not be able to get to the solution you are looking for.

the product options should be available on the product detail page. The product detail page will filter the products on a querystring vartiable.

for an item to have multiple options types, say color and size, you need to create a cat column for each option type set each of these cart columns to be unique.

In the Add to cart button server behavior, set each of those columns to updatable. from a select list.


If the options are coming from a database, you need to create a recordset for each of the possible options types.


using the database structure given previously in this thread, you will need to create a join query for each option group.

Lets in the option group tabel you have:

optiongroupID | optiongroupName
1 | size
2 | color


the recordset to return the options for size will look like:
SELECT options.optionName
FROM options
INNER JOIN optiongroups ON options.optionOptiongroupID = optiongroups.optiongroupID
INNER JOIN productoptions ON productoptions.productoptionOptionID = options.optionID
WHERE optiongroups.optiongroupID = 1 AND productoptions.productoptionProductID = $_GET['ProdID']



The recordset for color would be the same except the optiongroups.optiongroupID = 2.

Sign in to reply to this post

sologray

database setup where price depends on size and color,style are options.

This post has been deleted.

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