[size=10pt][font=arial]Hi folks,
I am trying to get the code to call the product options via the associate id to display the multiple options with the same associate id to be displayed alongside the main product details but I am not sure how to do this correctly… Help would be awesome!..
“productdetails” table holds associate id, product name, description and image details - “productoptions” table holds associate id (which there can be multiple “options” in this table with the same associate id but the other option details are different) and option description, option price and option status…
[php]$query = “SELECT associate_id, product_id, product_name, product_description, product_image, category_id FROM productdetails WHERE category_id = ‘0002’ ORDER BY category_id, product_id ASC LIMIT $offset, $recordsPerPage;”;
$result = mysql_query($query) or die(‘Error retrieving product listings. Please inform us of this issue.’);
$listproducts = ‘
while($row = mysql_fetch_assoc($result)) {
$associateid = $row[associate_id];
$row[product_name] = stripslashes($row[product_name]);
$row[product_description] = stripslashes($row[product_description]);
$listproducts .= "\n
\n<div id=\"productview\">
\n\t<table class=\"productname\">
\n\t<tr valign=\"middle\">
\n\t<td class=\"productname\">
\n\t$row[product_name]
\n\t</td>
\n\t</tr>
\n\t</table>
\n\t<table class=\"productoverview\">
\n\t<tr valign=\"top\">
\n\t<td class=\"productpicture\">
\n\t<img src=\"_productimages/_thumbs/$row[product_image]\" title=\"$row[product_name]\" border=\"0\" />
\n\t<p>
\n\t<span class=\"enlargephoto\"><a id=\"showlargepic\" href=\"_productimages/$row[product_image]\" class=\"enlarge\">Enlarge Photograph</a></span>
\n\t</td>
\n\t<td class=\"productdetails\">
\n\t$row[product_description]
\n\t<p>
\n\tTHIS IS WHERE THE OTHER WHILE LOOP NEEDS TO BE PLACED (code below) TO SHOW MULTIPLE OPTIONS FROM ANOTHER TABLE WHICH RECORDS ARE ASSOCIATED WITH - "ASSOCIATE_ID" -
\n\t</td>
\n\t</tr>
\n\t</tr>
\n\t</table>
\n<p>
\n</div>";
}[/php]
CODE BELOW NEEDS TO BE PLACED IN THE “productdetails” TABLE CELL UNDER THE “$row[product_description]
” LINE… Anyone able to give me some help!??
[php]$associateid = mysql_real_escape_string($associateid); //call product purchase options in the “productoptions” table via product “associate_id” which is in both “productdetails” and “productoptions” tables…
$sql = “SELECT associate_id, product, product_option_description, product_option_price, product_option_status FROM productoptions WHERE associate_id = $associateid”;
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$associate_id = $row["associate_id"];
$product = $row["product"];
$product_option_description = $row["product_option_description"];
$product_option_price = $row["product_option_price"];
$product_option_status = $row["product_option_status"];
if ($product_option_status == "Temporarily Sold Out") {
$purchaseproduct = "<a id=\"notinstockmsg\" href=\"#productnotinstockmsg\" class=\"basketnotstock\">Add to Basket</a><p>";
}
elseif ($product_option_status == "Coming Soon") {
$purchaseproduct = "<a id=\"comingsoonmsg\" href=\"#productcomingsoonmsg\" class=\"basketnotstock\">Add to Basket</a><p>";
}
elseif ($product_option_status == "Made To Order") {
$purchaseproduct = "<a href=\"basket.php?action=addtobasket&productid=".$product_id."&categoryid=".$categoryid."&cmrbasketid=".$basketid."\" title=\"add ".$row[product]." to basket\" class=\"basketinstock\">Add to Basket</a><p>";
}
else {
$purchaseproduct = "<a href=\"basket.php?action=addtobasket&productid=".$product_id."&categoryid=".$categoryid."&cmrbasketid=".$basketid."\" title=\"add ".$row[product]." to basket\" class=\"basketinstock\">Add to Basket</a><p>";
}
}[/php]
Thank you for any help you are able to give!
TD[/font][/size]