close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

product options and related sql joins

Thread began 7/20/2010 10:10 am by michael392999 | Last modified 7/21/2010 1:27 am by Dave Buchholz | 1010 views | 1 replies |

michael392999

product options and related sql joins

Hello WA forum

I am coding a clothing store site for a client using DWCS4, php, Mysql, ecart5 and the WA ecommerce database sql file which I have modified to allow for a wider range of size and colour option groups, basically creating optionsize, optioncolor in place of options and optiongroupsize, optiongroupcolor in place of optiongroups. Was this a bad idea?

I am really struggling with how to populate the productoptions table which seems to act as a link between the options and the product table. I currently only have one record entered in this table which I have been using as a test to return the correct data against a single productID before inserting and populating the other fields. Also despite many hours I'm unable to create a sql join query which allows the size and and colour options to display although I get no sql error messages so perhaps the sql query is correct and it is the table structure that is at fault?

The sequel queries are....

$paramItem_rsSize = "-1";
if (isset($row_WADAproducts['ProductID'])) {
$paramItem_rsSize = (get_magic_quotes_gpc()) ? $row_WADAproducts['ProductID'] : addslashes($row_WADAproducts['ProductID']);
}
mysql_select_db($database_dsTenn, $dsTenn);
$query_rsSize = sprintf("SELECT productoptions.ProductOptionID, optionssize.OptionSizeName, optionssize.OptionGroupSizeID, optiongroupsize.OptionGroupSizeName FROM optionssize INNER JOIN productoptions ON optionssize.OptionSizeID = productoptions.ProductOptionID INNER JOIN optiongroupsize ON optionssize.OptionGroupSizeID = optiongroupsize.OptionGroupSizeID WHERE optiongroupsize.OptionGroupSizeName = 'Mens-Waist' AND productoptions.ProductID = %s", GetSQLValueString($paramItem_rsSize, "int"));
$rsSize = mysql_query($query_rsSize, $dsTenn) or die(mysql_error());
$row_rsSize = mysql_fetch_assoc($rsSize);
$totalRows_rsSize = mysql_num_rows($rsSize);

$paramItem_rsColor = "-1";
if (isset($row_WADAproducts['ProductID'])) {
$paramItem_rsColor = (get_magic_quotes_gpc()) ? $row_WADAproducts['ProductID'] : addslashes($row_WADAproducts['ProductID']);
}
mysql_select_db($database_dsTenn, $dsTenn);
$query_rsColor = sprintf("SELECT productoptions.ProductOptionID, optionscolor.OptionColorName, optionscolor.OptionGroupColorID, optiongroupcolor.OptionGroupColorName FROM optionscolor INNER JOIN productoptions ON optionscolor.OptionColorID = productoptions.ProductOptionID INNER JOIN optiongroupcolor ON optionscolor.OptionGroupColorID = optiongroupcolor.OptionGroupColorID WHERE optiongroupcolor.OptionGroupColorName = 'A02050000' AND productoptions.ProductID = %s", GetSQLValueString($paramItem_rsColor, "int"));
$rsColor = mysql_query($query_rsColor, $dsTenn) or die(mysql_error());
$row_rsColor = mysql_fetch_assoc($rsColor);
$totalRows_rsColor = mysql_num_rows($rsColor);

----------------------------------------------------------------------------------

Also I don't really understand how these options are used to obtain a single productID which is then added to the basket? I would be grateful if anyone could explain.

I have read many forum threads and followed the WA product options documentation but still the penny hasn't quite dropped with this and I'm fast running out of time.

Can anyone help or recommend a freelance resource that could quickly help resolve these issues for me?

Many thanks for any assistance in advance.

Sign in to reply to this post

Dave BuchholzBeta Tester

Michael,

I would need to look at your overall code but I could potentially help you on a freelance basis, feel free to contact me via my website or phone/skype.

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