I've created a shopping cart script and want to add an inventory control feature. The only problem is, when someone adds attributes to a product, the script needs to be able to track each and every attribute... Easier said than done.
I tested our another shopping cart script to see how they did it and this was the result (i've uploaded a screenie): http://img176.imageshack.us/img176/7639/inventorygj3.th.gif
There are three attributes in the above screen shot... Size, Color and Length... See how it merges them all together so that each and every attribute that could possible be selected is covered...
My problem is, how do I merge all my product attributes together like that and prevent duplicates etc...
I got started but got stumped... I thought I would select one atrribute and build on from there but I just can't figure out how I could do it...
Code: Select all
$query = mysql_query("select distinct(optionid) from {$tbl_name}listings_items_options where listingid='$_GET[listingid]' order by optionid asc limit 1") or die(mysql_error());
while($row = mysql_fetch_array($query)) {
$query2 = mysql_query("select * from {$tbl_name}listings_items_options where listingid='$_GET[listingid]' and optionid='$row[optionid]' order by valueid asc") or die(mysql_error());
while($row2 = mysql_fetch_array($query2)) {
// thats as far as I got...
}
}

