limelites:
Additionally, if you want the attribute in the drop down menu to automatically disable when the attribute quantity = zero, then you have to open /includes/modules/attributes.php and replace this:
$sql = "select pov.products_options_values_id,
pov.products_options_values_name,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$order_by;
> with this:
> ```php
$sql= "SELECT pov.products_options_values_id,
pov.products_options_values_name,
pa.*,
pwas.*
FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas ON pwas.stock_attributes = pa.products_attributes_id
WHERE pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and (pwas.quantity > 0 or pwas.quantity IS NULL)
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$order_by;
I've got a similar requirement on my site - if an attribute is out of stock it should be removed from the radio button list (radio buttons as opposed to dropdowns per the client's request).
This is somewhat complicated by the fact that each product has 2 attributes, so the attribute would only be removed if it's out of stock in ALL combinations.
A good example is this product:
http://www.vkoonyc.com/accessories-c-7/cashmere-loop-scarf-p-20
There's only one size, which makes it easy to test. It's out of stock in Mocha and Lt Grey, and I would like both of those attributes to be removed from the radio button list.
I tried limelite's code in attributes.php but it had no effect.
Using Zen Cart 1.3.9h w/ SBA 4.12.
Thanks in advance!