close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How do I add options to products

Thread began 2/08/2010 2:10 pm by crispin | Last modified 2/16/2010 2:01 pm by Jason Byrnes | 3748 views | 12 replies |

crispin

How do I add options to products

Please can you let me know if you have any PDF documentation on how to add and display different options for products using eCart5 - such as various colors.. and how this then passes to the checkout stage. I have uploaded the sample ecommerce DB and all looks fine i just need to know the next steps. Thanks very much for your help.

Sign in to reply to this post

Jason ByrnesWebAssist

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.

Sign in to reply to this post

crispin

Thanks!

Thanks for your guidance on this. i will try this out and see if I can get it to work. Not all products have a colour option so I'm thinking I need to use a bit of php to hide the drop down options menu if there is no result returned from the options recordset - Is this right?
Cheers

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

you can use the Dreamweaver Show region if recordset is not empty behavior to only show the list if there are options available.

Sign in to reply to this post

crispin

Cheers

Many thanks for the great support.

Sign in to reply to this post

crispin

Options not displaying in menus

Hi I've followed your instructions as closely as possible and it is not displaying my options in the drop down menu I've created.

The URL parameter being passed to the product detail page is simply 'product'

I have set up the recordsets just like you said.. one thing though, I could not select the 'type: Number' only 'type:Integer'

My recordset has turned out like this - can you be so kind as to run your expert eye over it to see if I've got anything wrong?:

Recordset detail:

$paramOptionID_rs_size = " -1";
if (isset($_GET['<product>'])) {
$paramOptionID_rs_size = $_GET['<product>'];
}
mysql_select_db($database_shoei_conn, $shoei_conn);
$query_rs_size = sprintf("SELECT options.* FROM options INNER JOIN productoptions ON options.OptionID = productoptions.OptionID WHERE options.OptionGroupID = 2 AND productoptions.ProductID = %s", GetSQLValueString($paramOptionID_rs_size, "int"));
$rs_size = mysql_query($query_rs_size, $shoei_conn) or die(mysql_error());
$row_rs_size = mysql_fetch_assoc($rs_size);
$totalRows_rs_size = mysql_num_rows($rs_size);


Is this right?

Sign in to reply to this post

crispin

All good

The recordset works .. I just had to remove the angled brackets <> from the URL param name.

Chris

Sign in to reply to this post

crispin

How do I add the new custom menu options to the cart?

Hi,

I have successfully got the options to display but how do i now add these values to the 'Ecart add to cart button' Bindings panel?

(The two fields are clicked as unique in the ecart)

... the fields size and colour are added to the bottom of the list in the bindings panel but what now? do I click the lightning bolt next to the size and colour column, then select OptionID or OptionName in the recordsets for the new size and colour fields?

What is the updatable checkbox for?

Basically I need the cart button to add the product as unique entries if different options have been chosen.. i.e a product with red option would display as one entry in the view basket list... and if it has been chosen again with the blue option chosen they will both be separate entries in the list...(and not just shown together as 2 items of the same product) if you see what I mean?

How do I do this... All good so far I just need this next stage explained

Thanks for your help

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

In the add to cart button behavior, on the bindings panel, set the color and size columns to be updateabel from a select list, this will create the select lists on the page for you.

You just need to update then to be dynamic and use the record sets to populate the list with options.

Sign in to reply to this post

crispin

Got it to work...

The drop down lists of options can be made from the recordsets no problem before choosing the 'add to cart button' behaviour.

Once in the Add to cart button panel, I added the custom fields to the list and then selected the OptionName from each recordset for the respective field.... checking the box 'updatable' creates hidden fields in the form that 'should' contain the values of the options.

However to make this work I had to delete these hidden fields and subsititute them for the drop down menus made previously... using the same 'name' descriptions given to the hidden fields i.e. 'eCart1_2_Size_Add' and 'eCart1_2_Colour_Add', ove this was done it passed the values to the cart just fine.

All good so far, I got to say though I think the documentation on ecart is a little thin. A thumbs up so far all the same.

Thanks for your help - (will probably add to this thread again today with more queries)

Chris

Sign in to reply to this post
loading

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