Ok, so I have the data displaying in a table... Kind of... The only problem is that the first option isn't displaying.
you can see what I mean on this page
http://buildingforhealth.com/proddetail.php?prod=IND_S_BAJI_FT
In the drop down menu there is Twin, Queen, King, and Cal. King, but in the table there is only Queen, King, and Cal. King.
Here is the code for the drop down:
<?php
if($rs["pSell"]==1){
$optionshavestock=true;
if(is_array($prodoptions)){
print '<div class="detailoptions" align="right"><table border="0" cellspacing="1" cellpadding="1">';
$rowcounter=0;
foreach($prodoptions as $rowcounter => $theopt){
$index=0;
$gotSelection=FALSE;
$cacheThis=! $useStockManagement;
while($index < (maxprodopts-1) && ((int)($aOption[0][$index])!=0)){
if($aOption[0][$index]==(int)($theopt["poOptionGroup"])){
$gotSelection=TRUE;
break;
}
$index++;
}
if(!$gotSelection){
$aOption[2][$index]=false;
$sSQL="SELECT optID,".getlangid("optName",32).",".getlangid("optGrpName",16)."," . $OWSP . "optPriceDiff,optType,optFlags,optStock,optPriceDiff AS optDims FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optGroup=" . $theopt["poOptionGroup"] . " ORDER BY optID";
$result = mysql_query($sSQL) or print(mysql_error());
if($rs2=mysql_fetch_array($result)){
if(abs((int)$rs2["optType"])==3){
$aOption[2][$index]=true;
$fieldHeight = round(((double)($rs2["optDims"])-(int)($rs2["optDims"]))*100.0);
$aOption[1][$index] = "<tr><td align='right' width='30%'><strong>" . $rs2[getlangid("optGrpName",16)] . ":</strong></td><td align='left'> <input type='hidden' name='optnPLACEHOLDER' value='" . $rs2["optID"] . "' />";
if($fieldHeight != 1){
$aOption[1][$index] .= "<textarea wrap='virtual' name='voptnPLACEHOLDER' cols='" . atb((int)($rs2["optDims"])) . "' rows='$fieldHeight'>";
$aOption[1][$index] .= $rs2[getlangid("optName",32)] . "</textarea>";
}else
$aOption[1][$index] .= "<input maxlength='255' type='text' name='voptnPLACEHOLDER' size='" . atb($rs2["optDims"]) . "' value=\"" . str_replace('"',""",$rs2[getlangid("optName",32)]) . "\" />";
$aOption[1][$index] .= "</td></tr>";
}else{
$aOption[1][$index] = "<tr><td align='right' width='30%'><strong>" . $rs2[getlangid("optGrpName",16)] . ':</strong></td><td align="left"> <select class="prodoption" onChange="updatepricePLACEHOLDER();" name="optnPLACEHOLDER" size="1">';
if((int)$rs2["optType"]>0) $aOption[1][$index] .= "<option value=''>".$xxPlsSel."</option>";
do {
$aOption[1][$index] .= '<option ';
if($useStockManagement && (($rs["pSell"] & 2)==2) && $rs2["optStock"] <= 0) $aOption[1][$index] .= 'class="oostock" '; else $aOption[2][$index]=true;
$aOption[1][$index] .= "value='" . $rs2["optID"] . "'>" . $rs2[getlangid("optName",32)];
if(@$hideoptpricediffs != TRUE && (double)($rs2["optPriceDiff"]) != 0){
$aOption[1][$index] .= "";
if(($rs2["optFlags"]&1)==1){
$cacheThis=FALSE;
$aOption[1][$index] .= FormatEuroCurrency(($rs["pPrice"]*$rs2["optPriceDiff"])/100.0) . "";
}else
$aOption[1][$index] .= FormatEuroCurrency($rs2["optPriceDiff"]) . "";
}
$aOption[1][$index] .= "</option>\n";
} while($rs2=mysql_fetch_array($result));
$aOption[1][$index] .= "</select></td></tr>";
}
}
if($cacheThis) $aOption[0][$index] = (int)($theopt["poOptionGroup"]);
}
print str_replace("updatepricePLACEHOLDER", (($rs["pPrice"]==0 && @$pricezeromessage != "") || @$noprice==TRUE ?"dummyfunc":"updateprice" . $Count), str_replace("optnPLACEHOLDER","optn" . $rowcounter, $aOption[1][$index]));
$optionshavestock = ($optionshavestock && $aOption[2][$index]);
$rowcounter++;
}
print "</table></div>";
}
}
}
if($rs["pSell"]==0){
print "";
}
?>
and this is the code for the menu:
<?php
if($rs["pSell"]==1){
$optionshavestock=true;
if(is_array($prodoptions)){
print '<div class="detailoptions" align="right"><table border="0" cellspacing="1" cellpadding="1">';
$rowcounter=0;
foreach($prodoptions as $rowcounter => $theopt){
$index=0;
$gotSelection=FALSE;
$cacheThis=! $useStockManagement;
while($index < (maxprodopts-1) && ((int)($aOption[0][$index])!=0)){
$index++;
}
if(!$gotSelection){
$aOption[2][$index]=false;
$sSQL="SELECT optID,".getlangid("optName",32).",".getlangid("optGrpName",16)."," . $OWSP . "optPriceDiff,optType,optFlags,optStock,optPriceDiff AS optDims FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optGroup=" . $theopt["poOptionGroup"] . " ORDER BY optID";
$result = mysql_query($sSQL) or print(mysql_error());
if($rs2=mysql_fetch_array($result)){
if((int)$rs2["optType"]>0);
$name='';
$price='';
while ($row= mysql_fetch_array($result)) {
$name .= '<td background="images/background.jpg" class="dark" align="center">' . $row[getlangid("optName",32)] . '</td>';
$price .= '<td bgcolor="#f0f2f7">' . FormatEuroCurrency($row["optPriceDiff"]) . '</td>';
if($cacheThis) $aOption[0][$index] = (int)($theopt["poOptionGroup"]);}
}
$optionshavestock = ($optionshavestock && $aOption[2][$index]);
$rowcounter++;
}
print "</table></div>";
}
}
}
if($rs["pSell"]==0){
print "";
}
?>
<table border="0" align="center" cellpad="0" cellspace="0"><tr><?php print $name; ?></tr>
<tr><?php print $price; ?>
</table>
Any ideas? :bemused: