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

Adding more product options

Thread began 4/12/2012 7:58 pm by phil107723 | Last modified 4/16/2012 12:07 pm by Jason Byrnes | 577 views | 3 replies |

phil107723

Adding more product options

Hi
I'm wanting to add more product options to my existing ecommerce website. I have worked my way through this tutorial product_options.php which is great and the your free database download very helpful . But I'm stuck on what kind of information to put in certain tables.

I have an item for sale at $200 at size 350mm the options are size 400mm for an extra $50, size 450mm for an extra $75 and another 2 sizes.
I have read this:
ecommerce-database/
but it didn't help.
So a product called Muffler1, code ADR001, that has the price $200 options 400mm for extra $50, 450mm for extra $75 what information would I enter into the tables on the database.

Table: optiongroups -OptionGroupID, OptionGroupName
Table: option - OptionID, OptionGroupID, OptionName
Table: productptions - ProductOptionID, ProductID, OptionID, OptionGroupID, OptionPriceIncrement
Table: productcategory - CategoryID, CategoryName

Have I said I think you're wonderful.
Thanks
Phil

Sign in to reply to this post

Jason ByrnesWebAssist

the optiongroups table defines that types of options you will offer, create a new record and set the OptionGroupName to "Size", the OptionGroupID will automaticly be assigned a number, if it is the first record, the number will be set to 1:

optiongroups:
| OptionGroupID | OptionGroupName |
|---------------|-----------------|
| 1 | Size |
|---------------|-----------------|




the options table defines the options that belong to a group, create a new record for each size option, set the OptionGroupID to use the number for the size option in the optiongroups table, and the OptionName to the name of the size:

options:
| OptionID | OptionGroupID | OptionName |
|----------|---------------|------------|
| 1 | 1 | 350mm |
|----------|---------------|------------|
| 2 | 1 | 400mm |
|----------|---------------|------------|
| 3 | 1 | 450mm |
|----------|---------------|------------|



the productptions table assigns the options to the product. the ProductOptionID is an auto inclrement column and will automaticly get a value.

the ProductID column should be the ID for the products, it relates to the products.ProductId

the OptionID column is the ID for the option from the options.OptionId column

the OptionGroupID is the ID of the optiongroup from the optionsgroups.OptionGroupID

the OptionPriceIncrement defines how much more the option will cost for that product
this is an example if the ID of the product is 1923

productptions:
| ProductOptionID | ProductID | OptionID | OptionGroupID | OptionPriceIncrement |
|-----------------|-----------|----------|---------------|----------------------|
| 1 | 1923 | 1 | 1 | |
|-----------------|-----------|----------|---------------|----------------------|
| 2 | 1923 | 2 | 1 | 50 |
|-----------------|-----------|----------|---------------|----------------------|
| 3 | 1923 | 3 | 1 | 75 |
|-----------------|-----------|----------|---------------|----------------------|
Sign in to reply to this post

phil107723

Thanks for that.I had that right but I'd chosen rsSizeLookuo instead of rsSize for my select list which gave me my problem.

I was going through to see why the price increment wasn't adding to my cart when I found this back in the ecart object
Instead of [Price]+[sizePriceInc] it reverts to this [Price] +[size]PriceInc and the same thing for this [Price]+[sizePriceInc] * [Quantity] it reverts to this ([Price]+[size]PriceInc) * [Quantity]

I've just changed the column from sizePriceInc to SizePriceInc and in the add to cart column bindings.

But the price increase still isn't adding to the cart . And in fact the product detail page is now redirecting to itself.

This is my add to cart code:
<?php
// WA eCart AddToCart
if (isset($_POST["eCart1_1_ATC"]) || isset($_POST["eCart1_1_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "TESTshop_cart.php";
$ATC_RedirectIfIn = "";
if (isset($totalRows_rsSingle_product) && $totalRows_rsSingle_product > 0) {
$row_rsSingle_product = WAEC_findRecordMySQL($rsSingle_product, "productID", $ATC_itemID);
if ($row_rsSingle_product) {
$ATC_itemName = "".$_POST["eCart1_1_Name_Add"] ."";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = "".$_POST["eCart1_1_Price_Add"] ."";// column binding
$ATC_itemConfig = "".$_POST["eCart1_1_Config_Add"] ."";// column binding
$ATC_itemlength = "".$_POST["eCart1_1_length_Add"] ."";// column binding
$ATC_itemInlet = "".$_POST["eCart1_1_Inlet_Add"] ."";// column binding
$ATC_itemImage = "".$_POST["eCart1_1_Image_Add"] ."";// column binding
$ATC_itemFourInchOption = floatval("".$_POST["eCart1_1_FourInchOption_Add"] ."");// column binding
$ATC_itemsize = "".$row_rsSizeLookup['OptionName'] ."";// column binding
$ATC_itemSizePriceInc = floatval("".$row_rsSizeLookup['OptionPriceincrement'] ."");// column binding
mysql_data_seek($rsSingle_product, 0);
$row_rsSingle_product = mysql_fetch_assoc($rsSingle_product);
}
}
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCart1->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice, $ATC_itemConfig, $ATC_itemlength, $ATC_itemInlet, $ATC_itemImage, $ATC_itemFourInchOption, $ATC_itemsize, $ATC_itemSizePriceInc);
if ($ATC_RedirectAfter != "" && $eCart1->redirStr == "") {
$eCart1->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?>
What am I doing wrong?
Phil

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

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