...

View Full Version : shopping cart table



nurvirus
08-09-2007, 03:20 PM
hye guys, i really2 need your help. I'm doing a shopping cart.
But the thing is..I dont want the select product row appears after
i've choosen 1 product item unless i click on the Add product button.
How can i do that? Thank you for your time and hope this thread can help other ppl who is doing shopping cart in the future ;)

http://i12.photobucket.com/albums/a208/n_amalyna/cart.jpg



<table border="1" width="70%">
<tr bgcolor="#CCCCCC">
<td width="" align="center"><input type="checkbox" name="allbox" onClick="checkAll()"></td>
<td width="" align="center">NO.</td>
<td width="" align="center">PRODUCT</td>
<td width="" align="center">UNIT PRICE</td>
<td width="" align="center">QUANTITY</td>
<td width="" align="center">TOTAL</td>
</tr>
<?
for($counter=1; $counter <= $itemCount; $counter++)
{
?>
<tr>
<td width="" align="center"><input type="checkbox" name="checkProduct[]" value="<? echo $counter; ?>" onclick="uncheckAll(this)"></td>
<td width="" align="center"><? echo $counter; ?></td>





<?

$aPro = db_query("SELECT * FROM product_ms");
if (!is_array($aPro))
{
echo "no product available";
}
else if ($counter < $itemCount)
{
foreach ($aPro as $row2)
{
if ($arr[$counter][1] == $row2["product_code"])
{
$totalProduct_out= $arr[$counter][2] * $row2["product_price"];
$totalProduct_out = number_format($totalProduct_out, 2);
?>
<td width="" align="center"><input type="hidden" name="<? echo "p".$counter; ?>" value="<? echo $row2["product_code"] ?>"><?echo $row2["product_desc"]?></td>
<td width="" align="right">RM <input type="hidden" size="5" name="<? echo "priceOutput".$counter; ?>" type="text" value="<? echo $row2["product_price"] ?>"><?echo $row2["product_price"]?></td>
<td width="" align="center"><input type="hidden" name="<? echo "q".$counter; ?>" type="text" value="<? echo $arr[$counter][2]; ?>"><?echo $arr[$counter][2];?></td>
<td width="" align="right">RM <input name="<? echo "totalProduct_out".$counter; ?>" type="hidden" value="<? echo $totalProduct_out ?>"><? echo $totalProduct_out ?></td> </tr>
<?
}
}
}
else
{
?>
<td width="" align="center">
<select class="standardselect" name="<? echo "p".$counter; ?>" onchange="showPrice(this.value,<? echo "q".$counter; ?>.value)">
<option value="">--Select product--</option>
<?
$aProduct = db_query(" SELECT * FROM product_ms WHERE product_display = 'Y' order by product_code ");

if (!is_array($aProduct) )
{
echo "<option value=''>no Product available</option>";
}
else
{
foreach ($aProduct as $rowProduct)
{
echo "<OPTION VALUE=".($rowProduct["product_code"]).">".($rowProduct["product_desc"])."</OPTION>";
}
}
?>
</select>
</td>
<td width="" align="center">RM <input size="5" name="priceOutput" type="text" value="" readonly="true">
</td>
</td>
<td width="" align="center">
<select class="standardselect" name="<? echo "q".$counter; ?>" onchange="totalProduct(this.value, priceOutput.value)">
<?
for($i=1;$i<=10;$i++)
{
echo "<option value=".$i.">".$i."</option>" ;
}
?>
</select>
</td>
<td width="" align="center">RM <input size="5" name="totalProduct_out" type="text" value="" readonly="true"></td>
<?
}
}
?>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td colspan="2"></td>
<td align="left"><br>
<input type="submit" name="btnAdd" value="Add Product" style="font-size: 12px; width: 80px;" />&nbsp;&nbsp;&nbsp;
<input type="submit" name="btnDelete" value="Delete Product" style="font-size: 12px; width: 90px;" />
</td>
</tr>

nurvirus
08-09-2007, 05:22 PM
anyone?

nurvirus
08-10-2007, 04:58 AM
hmmmm?

meth
08-10-2007, 05:28 AM
Sorry, but is english your 2nd language? If I have to read a post more than twice to gather it's meaning, I give up and move on. Not enough spare time to try and interpret obscure meanings.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum