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

rating

Can DataAssist wizard include "product options"?

Thread began 11/02/2010 6:08 pm by thetypehouse | Last modified 11/04/2010 12:09 pm by Jason Byrnes | 930 views | 7 replies |

thetypehouse

Can DataAssist wizard include "product options"?

Hi

This is only my second attempt at working with databases (the first went OK), so please bear with me!

The site I'm developing needs products, and category and colour options.

I've been following the DA Getting Started Guide, and succeeded in setting up a set of Product_Results/Insert/Update/Detail pages. However, as I want also to be able to include product colours, I tried running the wizard again (having first moved the resulting files to another folder).

It looks to me as though productionoptions doesn't have a column in the products table (as productcategories does). Instead, the foreign key (if I've got this right!) has to go through the productoptions table in order to be linked to the options table. Is that right?

I did try setting the ProductID as a menu item dynamically linked to OptionID (in a similar way to that done with productcategories), but Dreamweaver crashed mid-way through creating the first of the pages.

I wonder if the wizard would work if I added a column OptionID to the products table. Or have I got this completely wrong?!

I'd be very grateful for any help/advice you can offer.

Thanks
Alistair
PS I've populated the options table with data
e.g.
1 Blue
2 Red
3 Grey
etc.
so there are data to pull in.

Sign in to reply to this post

Jason ByrnesWebAssist

The product pages that you create using the wizard can be modified to handle product options, but the wizard will not be able to do this for you.
you would need to use the manage relational table behavior insert to the product options table the options that are availbale for the particular product.

you would first create a recordset to return all options from the options table.
add a checkbox to the page and set the value to use the options ID from the recordset. Add a repeat region around the recordet so that a checkbox will be created for each one.

you can then add the manage relational table behavior to the page so store the selections for the product in the productoptions table.

Sign in to reply to this post

thetypehouse

Hi Jason
Thanks for your advice.

1. I've gone back to the previous set of files created by the DA Wizard and created a recordset, which I've called rs_getOptions. This then populates a list of options with checkboxes on the Insert page (via repeat region on a <ul>).

2. I've added a Manage Relational Table behaviour to the page
(it shows as Manage Relational Table (productoptions) in the Server Behaviors list), and despite trying both 'Button Insert pressed' and 'any form post' as triggers, only the Products table is being updated; nothing appears in the productoptions table.

As I'm probably doing something wrong in the Manage Relational Table wizard I've attached screenshots of my entries so you can see what I've done.

Thanks!
Alistair

Attached Files
ManageRelationTable4steps1-2.zip
ManageRelationTable4steps3-4.zip
Sign in to reply to this post

Jason ByrnesWebAssist

can you send a copy of your page so I can inspect the code.

Sign in to reply to this post

thetypehouse

Thanks, Jason

Here it is now.

Attached Files
products_Insert.zip
Sign in to reply to this post

Jason ByrnesWebAssist

On step 2, choose the WADA_Insert_products session variable instead of the WADAInsertRecordID form element

Sign in to reply to this post

thetypehouse

Of course, silly me! Thanks!

So, the productoption table is now updated, and I've fixed another problem so that the OptionGroupID is correctly inserted.

However, currently the productoptions table is entering all 16 options, regardless of which checkboxes were ticked. Presumably the insert code needs to enter either 1 or 0 to ensure that only the chosen options are inserted into the productoptions table.

So you can see what I'm talking about, here is the header and some lines from the productoptions table. Although only a few of these option were selected, they are all appearing in the table:
ProductOptionID ProductID OptionID OptionGroupID OptionPriceIncrement
33 9 1 1 NULL
34 9 2 1 NULL
35 9 3 1 NULL
36 9 4 1 NULL
37 9 5 1 NULL
38 9 6 1 NULL
39 9 7 1 NULL
40 9 8 1 NULL
41 9 9 1 NULL
...

I've looked through the code and can't see where one would modify the SQL insert to show 0,1 (if indeed this is the right way of doing it anyway). Or perhaps there needs to be an "if checkbox is selected insert; else do nothing".

(I'm about to add similar modifications to the products_Detail and products_Update pages so we can see which options have been chosen for any particular product. I think I can work out what to do for these, but we'll see!)

Here's the most recent version of the products_Insert page.

Thanks for your continued help.

Attached Files
products_Insert.zip
Sign in to reply to this post

Jason ByrnesWebAssist

On step three of the manage relational table, set the Options From Field to use the Color checkboxes instead of the WADA_RepeatID_OptionID

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

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