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

rating

Product Options Administrative Tutorial?

Thread began 11/03/2011 9:49 am by Justin@AdventDesign | Last modified 11/04/2011 10:13 am by Jason Byrnes | 1271 views | 12 replies |

Justin@AdventDesign

Product Options Administrative Tutorial?

Working with eCart using Product Options for the first time. I've been through the "Product Options with eCart" tutorial, and believe everything there is set up correctly. Is there a tutorial or guide for setting up the administrative pages properly in order to add product options to individual products?

With 4 different tables to deal with (products, productoptions, options, optiongroups) I'm having trouble getting my head around how to tie it all together so my customer can manage it with administrative pages.

Sign in to reply to this post

Justin@AdventDesign

Further clarification

I should clarify what I need to do. I don't, at this point, need the client to be able to add options groups or even options themselves, as these are constant. I do, however, need to be able to select the proper productoptions from the dataassist created insert and update pages for the products table.

In other words, while they are creating or updating product "A", they should be able to check or uncheck available material (or 'color' as it was in the options tutorial). I can create a recordset pulling the proper options based on the objectgroup ID, but I get lost as to how to get all that to write or delete the proper listings in the productoptions table while at the same time the page is writing to the products table.

Hoping since you had such a great tutorial on adding product options to the cart side, you have one as well for the admin side of options, but I don't see it.

Sign in to reply to this post

Jason ByrnesWebAssist

on the product insert / update pages, you would need to use the Data Assist manage relational table behavior.

you would create a recordset to return the available options.

add a checkbox to the page. Set the value of the cehckbox to use the optionID column from the option recordset, set the label for the check box to use the option name.

Now add a repeat region around the check box so it will loop through the option recordset to show all options.

*1- If this is the update page we need to create a binding in Dreamweaver before proceeding. Open the results page for the products table in the web browser, click on the update button for any product to open the update page, notice the address in the browser has a querystring variable, it will look something like this:
update?productID=3

Copy the name of the Querysting variable, in my example above it is "productID", then go to the bindings panel in Dreamweaver, click the plus button and select URL Variable, and paste the name that was copied from the browser. This will create a new databinding for the Query String variable used to load the product into the update page*

*-2 For the insert page, we need to find the name of the session that will be created when the product is inserted, go to the Server behaviors panel and double click the insert record behavior. In the session variable section, make note of the Save As setting, this is the name of the session that will be created.

cancel out of the insert record behavior, and go to the bindings tab, expand the session collection and make sure a session binding with the name from the save as setting in the insert record behavior exists*

Next add the Manage Relational Table behavior.

On the first step, set the relational table to be the productsoptions table

On the Second Step, the "Main table Join" column is the productD column, set the data type to numeric.
- On the Insert page, click the lightning bolt next to Key value and select the Session variable that is created by the insert record behavior (refer to *-2 above)

- On the update page click the lightning bolt next to Key value and select the URL Variable used to populate the update page (refer to *-1 above)

On the Third step, set the foreign key column to the OptionID, for Options From Field, select the Repeating checkbox. on the forth step, you can review the settings and click finish

Sign in to reply to this post

Justin@AdventDesign

Wow. The cart side was easier than I thought so hopefully the admin side will be too! I'll give it a shot. Thanks for the info. I'd urge you to make this into a full blown tutorial at some point, as anyone incorporating options will need this every bit as much as the cart integration.

Sign in to reply to this post

Justin@AdventDesign

Almost got it

Great instructions Jason. Everything went exactly as you described and appeared to be correct. However, after completing all the steps I get the following error trying to load the update page:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Applications/XAMPP/xamppfiles/htdocs/beta/00_Aveo/sitecontrol/tbProducts_Update.php on line 269

Line 269 is:
$WA_joinLoopedField = "<?php echo $row_rsMaterialoptions['OptionID']; ?>";

Which is right in the midst of the Relational Table stuff here:

<?php
// WA DataAssist Manage Relational Table 1
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_arrayOrFieldList = 1;
$WA_joinLoopedField = "<?php echo $row_rsMaterialoptions['OptionID']; ?>";
$WA_loopedField = "WADA_RepeatID_OptionID";
$WA_connection = $adventcms;
$WA_table = "productoptions";
$WA_redirectURL = "";
$WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_masterKeyField = "ProductID";
$WA_masterKeyType = "none,none,NULL";
$WA_masterKeyValue = "".$_GET['id'] ."";
$WA_masterKeyComp = "=";
$WA_joinedKeyField = "OptionID";
$WA_joinedKeyType = "none,none,NULL";
$WA_joinedKeyComp = "=";
$WA_fieldNamesStr = "ProductID|OptionID";
$WA_columnTypesStr = "none,none,NULL|none,none,NULL";
$WA_appliedString = "";
$WA_appliedList = array();
$WA_valuesList = array();
$WA_connectionDB = $database_adventcms;
mysql_select_db($WA_connectionDB, $WA_connection);
if ($WA_arrayOrFieldList == 0) {
$WA_loopedValues = $_POST[$WA_joinLoopedField];
for ($v=0; $v<sizeof($WA_loopedValues); $v++) {
$WA_fieldValues = "^MASTERID^" . "|" . "^JOINID^";
$WA_valuesList[] = array($WA_loopedValues[$v], $WA_fieldValues);
$WA_appliedString .= "^" . $WA_loopedValues[$v] . "^";
$WA_appliedList[] = $WA_loopedValues[$v];
}
}
else if ($WA_arrayOrFieldList == 1) {
$WA_mrtLoopCounter = 0;
while (WA_AB_checkLoopedFieldsExist(array($WA_loopedField), $WA_mrtLoopCounter)) {
if (WA_AB_checkLoopedFieldsNotBlank(array($WA_joinLoopedField), $WA_mrtLoopCounter) && WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter) == WA_AB_getLoopedFieldValue($WA_joinLoopedField, $WA_mrtLoopCounter)) {
$WA_fieldValues = "^MASTERID^" . "|" . "^JOINID^";
$WA_valuesList[] = array(WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter), $WA_fieldValues);
$WA_appliedString .= "^" . WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter) . "^";
$WA_appliedList[] = WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter);
}
$WA_mrtLoopCounter++;
}
}
WA_AB_doManageRelationalTable($WA_valuesList, $WA_appliedString, $WA_appliedList, $WA_connection, $WA_table, $WA_masterKeyField, $WA_masterKeyType, $WA_masterKeyValue, $WA_masterKeyComp, $WA_joinedKeyField, $WA_joinedKeyType, $WA_joinedKeyComp, $WA_fieldNamesStr, $WA_columnTypesStr);
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>

Sign in to reply to this post

Justin@AdventDesign

Same error on the same line after completing the insert page as well.

Sign in to reply to this post

Jason ByrnesWebAssist

it looks like you selected the OptionID column from the rsMaterialoptions recordset in step 3 of the manage relational table behavior instead of the checkbox in the repeat region.

double check that the settings in the manage relational table on the update page are the same as for the insert page.

the only difference on the update page will be using the URL Variable for the Main table Join Key value.


nowhere do you use a recordset value in the manage relational table behavior.

Sign in to reply to this post

Justin@AdventDesign

Wow something went haywire

I set the key column to the OptionID as suggested. The options from pull menu only gave me one option, which was a bunch of PHP code.

I went back in to the Manage Relational Table dialog to check your suggestion, and I got several pop warnings of errors including "THe column name "false' was not found." and "The column name "".((isset($POST["WADAInsertRecordID"....etc., was not found."

Then once into the dialog, the selections were all goofy.Clearly something went wrong. I'm starting over with the original insert and update posts from scratch. Will let you know what happens.

Sign in to reply to this post

Justin@AdventDesign

Ran through from the start, same problem

Ran through from the beginning, same problem...

I've attached progressive screen shots showing the settings I'm entering and what I am seeing for your information.

Here's what I did per your steps:

Originally Said By: Jason Byrnes
  on the product insert / update pages, you would need to use the Data Assist manage relational table behavior.

you would create a recordset to return the available options.

DONE - named rsMaterialoptions

add a checkbox to the page. Set the value of the cehckbox to use the optionID column from the option recordset, set the label for the check box to use the option name.

DONE - and confirmed it was loading properly

Now add a repeat region around the check box so it will loop through the option recordset to show all options.

DONE - all the proper rows repeat properly with the proper value

*1- If this is the update page we need to create a binding in Dreamweaver before proceeding. Open the results page for the products table in the web browser, click on the update button for any product to open the update page, notice the address in the browser has a querystring variable, it will look something like this:
update?productID=3

DONE - mine is actually 'id', I'm using almost all the sample options database provided by web assist, but I'm tying it to my own existing master product table rather than the 'products' one provided.

Copy the name of the Querysting variable, in my example above it is "productID", then go to the bindings panel in Dreamweaver, click the plus button and select URL Variable, and paste the name that was copied from the browser. This will create a new databinding for the Query String variable used to load the product into the update page*

*-2 For the insert page, we need to find the name of the session that will be created when the product is inserted, go to the Server behaviors panel and double click the insert record behavior. In the session variable section, make note of the Save As setting, this is the name of the session that will be created.

DONE

cancel out of the insert record behavior, and go to the bindings tab, expand the session collection and make sure a session binding with the name from the save as setting in the insert record behavior exists*

DONE - update page still works properly at this point.

Next add the Manage Relational Table behavior.

On the first step, set the relational table to be the productsoptions table

DONE

On the Second Step, the "Main table Join" column is the productD column, set the data type to numeric.
- On the Insert page, click the lightning bolt next to Key value and select the Session variable that is created by the insert record behavior (refer to *-2 above)

- On the update page click the lightning bolt next to Key value and select the URL Variable used to populate the update page (refer to *-1 above)

DONE, set to id as noted above

On the Third step, set the foreign key column to the OptionID, for Options From Field, select the Repeating checkbox. on the forth step, you can review the settings and click finish  



DONE - I'm only given one option for hte options from field, but it appears to be PHP code that fits your description (see screen shot attached)

When I get done, I save the page and attempt to browse to the update from the results page and get the error I noted above. I then go back to the Manage Relational Table behavior I get a bunch of errors which I have on the screen capture.

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

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