close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Admin - Assigning Product Options - Revised Help

Thread began 4/11/2012 1:45 am by Christopher West | Last modified 4/12/2012 10:57 am by Christopher West | 648 views | 3 replies |

Christopher WestCommunity Expert

Admin - Assigning Product Options - Revised Help

Hi, in reference to something I have enquired about before, And after coding part of the admin area to add/update Product OPTIONGROUPS and Product OPTIONS for an online store. I just need need help on the steps connect the PRODUCTOPTIONS to a product.

I have attached an image to show what I need. I just cannot get my head around the best way of doing it.

the image is a screenshot of some options that pulled in by a URL ProductID reference.

ProductGroups are made up of either (1) text box option (2) tick box option (3) select list of options (the select list contents also differs per optiongroup). (on the example page you only see options for text box or select list) the tick boxes on the right side are additional "choices" for the ProductOptions table that is used to reference to the product.

I want the admin to add a "option group" to a product this is then displayed in the example screenshot (note: Admin can add the same OptionGroup as you can see in the screenshot).

The screenshot is based on code I have already put in place. EG to display the Options that you can see in the screenshot I used:

SELECT *
FROM productoptions LEFT JOIN optiongroups ON productoptions.OptionGroupID = optiongroups.OptionGroupID
WHERE ProductID = colname

The point of the tick box on the far left will allow the Admin to "deselect" the tickbox so that when the save button is pressed it will delete the association of that particular option from the product.

The select list that you see in the bigger box will also output the options associated with that particular optiongroup (which I had assigned on a different page to create an optiongroup. - So Im guessing I would need to hand code a recordset inside the "repeat region of the form.

Also I am guessing I would need to used an Update Multiple records as well.

But this is where I am stuck, as I cannot seem to figure out method of coding..

Could you please let me know the the method of getting this particular page to work in how I described above?

Here is an idea of my databse structure to get an idea on how it all connects:

CREATE `optiongroups` (
`OptionGroupID` int(11) NOT NULL AUTO_INCREMENT,
`OptionGroupName` varchar(50) DEFAULT NULL,
`OptionGroupType` varchar(20) NOT NULL,
PRIMARY KEY (`OptionGroupID`)

CREATE `options` (
`OptionID` int(11) NOT NULL AUTO_INCREMENT,
`OptionGroupID` int(11) DEFAULT NULL,
`OptionName` varchar(50) DEFAULT NULL,
`OptionPrice` float NOT NULL,
PRIMARY KEY (`OptionID`)

TABLE `productoptions` (
`ProductOptionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ProductID` int(10) unsigned NOT NULL,
`OptionGroupID` int(10) unsigned NOT NULL,
`OptionIncluded` tinyint(1) NOT NULL,
`OptionRequired` tinyint(1) NOT NULL,
`OptionSort` int(3) NOT NULL,
PRIMARY KEY (`ProductOptionID`)



regards

Chris

Sign in to reply to this post

Christopher WestCommunity Expert

I got most of it working (created the add Product Option) which then displays on the listing below it. Alos I created a recordset inside the loop (in the bottom box of the screenshot) and the "Price Included" and "Option Required" tick boxes show correct state stored in that record of the database).

...All I need to find out how to do, the following:

the tick box on the far left I want to show it ticked if that record belongs to the ProductOptions for that partcular product (ie ALL those options would have a "tick" state since the recordset it pulling the data by productoptions = product. HOWEVER what I would like to do is a USER can "untick" the box then once they click save it will DELETE that particular record.

Sign in to reply to this post

Jason ByrnesWebAssist

to delete the unclicked options would require hand coding.

you would need to code a loop that looked at each option to see if it was included in the form post or not, if it is not included in the form post, then it was checked so delete it.

it would be easier to show a list of options that had already been set for the product, and delete the ones that _are_ checked. you could do this using a dataAssist delete multiple records behavior.

use a recordset to show all the options fro the product from the productoptions table, add a check box to the page, use the ProductOptionID as the checked value. add a repeat region around the check box, then apply the delete multiple records behavior.

Sign in to reply to this post

Christopher WestCommunity Expert

Will try your method, for the time being Ive just done a simple "delete" icon to click on using a form for each record.

After posting this, I managed to get everything thing work I just need to drop in another recordset in my repeat region so that the options will display in the dropdown select list (as they are going to be all different depending which option). I thought it would be a lot harder then I was capable off, but I must have learnt some things by now as it all works, and I didnt even purchase another premier ticket for this one) :)

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