View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

items set up by color

Thread began 5/13/2009 5:55 pm by JBWebWorks | Last modified 10/15/2009 11:48 am by JBWebWorks | 5164 views | 37 replies

david390068Beta Tester

Option Items to display on music category page

Please help. I am new to eCart, but I have been reading a lot of posts regarding some of the items I am struggling with. If someone could help me out I would greatly appreciate it.

I am utilizing the sample BlueSkyCart with the sample dbase in PHP. What I am trying to accomplish is to have the available options for each product listed to display and allow the user to select the options and add to cart right from the music.php page. Each product might have more options than other. Any help would be greatly appreciated.

I have modified the default table structure to:

Items Table:
ItemID
ItemCatID
ItemName
ItemShortDesc
ItemLongDesc
ItemPrice
ItemSKU
ItemThumb
ItemImage
ItemWeight
ItemAvailable (varchar)
ItemInvCount (int)
ItemManufacturerID (int)

ItemOptions Table:
OptionID (int)
ItemID (int)
ItemOptionID (varchar)
ItemOptionValue (varchar)

Recordsets:
rsItems
SELECT *
FROM items
WHERE ItemCatID = 1 AND items.ItemAvailable = 'y' AND items.ItemInvCount > 0
ORDER BY ItemID ASC

rsOptions
SELECT *
FROM items INNER JOIN itemoptions ON items.ItemID = itemoptions.ItemID
WHERE items.ItemAvailable = 'y' AND items.itemInvCount > 0


music.php code:
<?php require_once('Connections/connBSM.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_connBSM, $connBSM);
$query_rsItems = "SELECT * FROM items WHERE ItemCatID = 1 AND items.ItemAvailable = 'y' AND items.ItemInvCount > 0 ORDER BY ItemID ASC";
$rsItems = mysql_query($query_rsItems, $connBSM) or die(mysql_error());
$row_rsItems = mysql_fetch_assoc($rsItems);
$totalRows_rsItems = mysql_num_rows($rsItems);

mysql_select_db($database_connBSM, $connBSM);
$query_rsOptions = "SELECT * FROM items INNER JOIN itemoptions ON items.ItemID = itemoptions.ItemID WHERE items.ItemAvailable = 'y' AND items.itemInvCount > 0";
$rsOptions = mysql_query($query_rsOptions, $connBSM) or die(mysql_error());
$row_rsOptions = mysql_fetch_assoc($rsOptions);
$totalRows_rsOptions = mysql_num_rows($rsOptions);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/siteassist_template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Blue Sky Music - [PageTitle]</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="siteassist_css/style.css" />
<link rel="stylesheet" type="text/css" href="siteassist_css/color.css" />
<link rel="stylesheet" type="text/css" href="siteassist_css/template.css" />
<link rel="stylesheet" type="text/css" href="siteassist_css/navigation.css" />
<link rel="stylesheet" type="text/css" href="siteassist_css/navigation_color.css" />
<link rel="stylesheet" type="text/css" href="siteassist_css/my_styles.css" />

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --><!-- InstanceParam name="Body_onLoad" type="text" value="" -->
</head><body id="subPage" onload="">
<div id="globalContainer">
<div id="borderTop"><img src="siteassist_images/spacer.gif" alt="" height="7"/></div>
<div id="logo"><img id="LogoImage" src="images/BSM_logo.gif" alt="Blue Sky Music" /></div>
<div id="topNavTop"><img src="siteassist_images/spacer.gif" alt="" height="4"/></div>
<div id="topNav">
<ul id="SAW_TopNavigation">
<li class="SAW_TopNav_Dark">
<div class="SAW_TopNavBorderLeft"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
<a href="index.php">Home&nbsp;Page</a>
<div class="SAW_TopNavBorderRight"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
</li>
<li class="SAW_TopNav_Dark">
<div class="SAW_TopNavBorderLeft"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
<a href="about.php">About</a>
<div class="SAW_TopNavBorderRight"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
</li>
<li class="SAW_TopNav_Dark">
<div class="SAW_TopNavBorderLeft"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
<a href="products.php">Products</a>
<div class="SAW_TopNavBorderRight"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
</li>
<li class="SAW_TopNav_Dark">
<div class="SAW_TopNavBorderLeft"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
<a href="cart.php">Cart</a>
<div class="SAW_TopNavBorderRight"><img alt="" src="siteassist_images/spacer.gif" width="1" height="1" /></div>
</li>
</ul>
<div style="clear: left;"></div>
</div>
<div id="header"></div>

<div id="innerContainerWrapper">
<div id="innerContainer">
<div id="innerLeft">
<div id="innerLeftTop"><img src="siteassist_images/inner_left_top.jpg" width="184" height="9" alt="" /></div>
<div id="sideNav">
<!-- InstanceBeginEditable name="SideNavigation" -->
<div id="SAW_SideNavigation">
<ul>
<li class="SAW_SideNav1_Selected_Bevel"><a href="music.php">Music</a></li>
<li class="SAW_SideNav1_Bevel"><a href="gear.php">Gear</a></li>
</ul>
</div>
<!-- InstanceEndEditable --></div>
<div id="resources"></div>
</div>
<div id="innerRight"><!-- InstanceBeginEditable name="PageBody" -->
<div class="contentBodyContainer">
<div class="hr"></div>
<h1>How underground are you? Show your BSM colors!</h1>
<p>Lorem ipsum dolor sit amet, consectetuer dulce et decorum est e pluribus unum fiat lux semper fidelis ad infinitum. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consectetuer dulce et decorum est e pluribus unum fiat lux semper fidelis ad infinitum. Lorem ipsum dolor sit amet. </p>
<?php do { ?>
<div id="catListing">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="104" rowspan="5"><span class="imageLeft"><a href="detail.php?ID=<?php echo $row_rsItems['ItemID']; ?>"><img src="images/thumbs/<?php echo $row_rsItems['ItemThumb']; ?>" alt="<?php echo $row_rsItems['ItemName']; ?>" width="99" height="97" border="0" /></a></span></td>
<td width="279"><a href="detail.php?ID=<?php echo $row_rsItems['ItemID']; ?>"><?php echo $row_rsItems['ItemName']; ?></a></td>
<td width="127">Option1</td>
</tr>
<tr>
<td><?php echo $row_rsItems['ItemShortDesc']; ?></td>
<td>Option2</td>
</tr>
<tr>
<td>$<span class="FeaturedItemBodyTextBold"><?php echo $row_rsItems['ItemPrice']; ?></span></td>
<td>Option3</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Option4</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Add to Cart</td>
</tr>
</table>
<p class="imageLeft">&nbsp;</p>
<h2>&nbsp;</h2>
<p>&nbsp;</p>
</div>
<?php } while ($row_rsItems = mysql_fetch_assoc($rsItems)); ?></div>
<!-- InstanceEndEditable --></div>
<div style="clear: left;"></div>
<div id="innerLeftBottom"><img src="siteassist_images/inner_left_bottom.jpg" width="184" height="4" alt="" /></div>
</div>
</div>
<div id="borderBottom"><img src="siteassist_images/spacer.gif" alt="" height="7"/></div>
</div>
<div id="footer">
<div class="siteFooterLinks"> <a href="sitemap.php">Sitemap</a> | <a href="termsofuse.php">Terms&nbsp;of&nbsp;Use</a> | <a href="privacypolicy.php">Privacy&nbsp;Policy</a> </div>
</div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($rsItems);

mysql_free_result($rsOptions);
?>

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