In your eCart object, create a new column named Colors. make sure to check the Unique Checkbox.
In a dynamic site with product options, you are best off adding the add to cart button to the product detail page. The results page will pass the product ID to the detail page as a query string variable, make note of this variable name.
When you add the add to cart button, set the Color column to be upgradeable from a select list. This will add the color select list to the page.
To populate the color select list, you will need to create a recordset to lookup the options from the database.
the sample eCommerce database is configured to be very flexible with product options. you can have different option categories such as size and color. You will need to create a separate recordset for each category. the tables that control options are:
optiongroups - defines the options groups:
OptionGroupID - Primary Key
OptionGroupName - Name of the option group, like size or color
options - defines the options, and assigns them to the option group:
OptionID - Primary Key
OptionGroupID - Forieign Key relation to optiongroups.OptionGroupID
OptionName - name of Option like Small or Red
productoptions - used to assign an option to a product:
ProductOptionID - Primary Key
ProductID - Forieign Key relation to product.ProductID
OptionID - Forieign Key relation to options.OptionID
OptionGroupID - Forieign Key relation to optiongroups.OptionGroupID
OptionPriceIncrement - used if the option should affect price.
from the optiongroups table, you will need to know the OptionGroupID value for the option group you are creating the recordset for. if the Color option group has an OptionGroupID of 1, the recordset will look like:
SELECT options.*
FROM options
INNER JOIN productoptions ON options.OptionID = productoptions.OptionID
WHERE options.OptionGroupID = 1 AND productoptions.ProductID = paramOptionID
you will need to create paramOptionID as a parameter in the Advanced recordset view to use the querystring variable that passes the product ID
Name: paramOptionID
type: Number
default value: -1
Run Time value: $_GET['<Querystring Variable Name>']
substitute <Querystring Variable Name> with the name of the querystring variable.
Once the recordset has been created, select the Color dropdown list in design view, in the property inspector, click the dynamic button. Select the recordset that was just created in the option from Recordset list, for both the name and the value, select the Option Name column.