I was able to get to the point of joining two tables and then hiding options from the list with a quantity of zero by filtering the results to only items with a quantity >0. What I actually need to do is always show all options, but add “Out of stock” next to any option that has a zero quantity. If anyone can help with this, I would appreciate it.
[php]
$sql2=mysql_query(‘SELECT * FROM shop_products_attributes LEFT JOIN shop_products_with_attributes_stock ON (shop_products_attributes.products_attributes_id=shop_products_with_attributes_stock.stock_attributes) WHERE shop_products_attributes.options_id=’.$rs1->options_id.’ AND shop_products_attributes.products_id=’.$rs->products_id.’ AND quantity>0 ORDER BY products_attributes_id desc’);
while($rs2=mysql_fetch_object($sql2)){
$output_attrib .= ‘<option value="’.getname(“products_options_values_id”,“shop_products_options_values”,“products_options_values_id”,$rs2->options_values_id).’">’.getname(“products_options_values_name”,“shop_products_options_values”,“products_options_values_id”,$rs2->options_values_id).’’;
}
$output_attrib .= ‘’;
}
[/php]