close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Sample WA Database - OPTIONS?

Thread began 5/11/2010 10:22 am by Art | Last modified 5/25/2010 4:18 pm by Art | 2464 views | 25 replies

Jason ByrnesWebAssist

This database is modeled after PowerStore and the way that power store handles options.

Of course there are always multiple ways of doing the same thing, this database was created to handle product options and be as flexible as possible.

It can be used for product options that don't effect price and product options that do effect price.

The reason for the price increment column being in the productoptions table is so that the same option can apply to different products and have a unique effect on the price. For example, you may have shirts and pants that are sold in XL. For shirts, the price could increment by $2.50 and for Pants the price could increase by $5.00.

By applying the price increment when the option is attached to the product, you gain more flexibility.

as for efficiency, that can be viewed in a number of ways.

For a database, the most efficient way to store data is to "normalize" it. the goal of normalizing data is to cut down on redundant text entries. This is done through using foreign key relations. The optiongroups and options table is a good example:
optiongroups
optionGroupID | OptionGroupName
1 | Size
2 | color

options:
OptionID | optionGroupID | OptionName
1 | 1 | Small
2 | 1 | Medium
3 | 1 | Large
4 | 2 | Red
5 | 2 | yellow
6 | 2 | Green

Instead of storing the string "Size" in the first three records we store the number "1" which is the ID. an integer uses 4 bytes of storage, where the string would use quite a bit more, see the following for details on storage requirements for different data types:
storage-requirements.html


The same technique is used in the productoptions table to relate each product to an option:
ProductOptionID | ProductID | OptionID | OptionGroupID | OptionPriceIncrement
1 | 1 | 1 | 1 |
2 | 1 | 2 | 1 | 0.50
3 | 1 | 3 | 1 | 1.50

This is an example of adding small Medium and Large options to product 1. I this example medium adds 0.50 cents, and large adds $1.50, now we could add another product with the same options but different pricing and also add color to this one:
ProductOptionID | ProductID | OptionID | OptionGroupID | OptionPriceIncrement
4 | 2 | 1 | 1 |
5 | 2 | 2 | 1 | 0.75
6 | 2 | 3 | 1 | 2.50
7 | 2 | 4 | 2 |
8 | 2 | 6 | 2 | 0.25

In this case, the product is available in small medium and large sizes, and red and green color. Since green die is so expensive, choosing green adds $.25. The medium size adds $.75 and the large option adds $2.50

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