Quote Originally Posted by athena View Post
Here is a link to a post in a thread called only: "Stock By Attributes" rather than this thread called: "Stock by Attribute v4.0 for Zen Cart 1.3.5+"

I think some of us have gotten lost in there but this post is significant - I just haven't had time to try it yet:

Quote Originally Posted by limelites View Post
Ahaaaaaaa, figured this one out guys!!

For anyone else having a problem with this issue, just look at re-installing the files that shipped with the stock_by_attributes mod.

I've just cured my problems by overwriting /includes/classes/order.php with the order.php from "stock_by_attributes_4-7MULTIADD mod"

Somehow some other mod had corrupted the data that updates the "Quantity in Stock" in ADMIN>CATALOG>PRODUCTS WITH ATTRIBUTES".

It is now updating the Quantity in Stock Column with each sale. All working perfectly now.

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:
PHP Code:
$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 Code:
$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
My attributes with stock are radio buttons and/or drop-down lists. I would like to use code similar to the one above, but instead of making the attributes disappear I would like to cause them to be grayed out (unselectable) and (ideally) apply a new style to them so that I can customize the "out of stock" options with a little CSS (which I suppose would be more applicable to radio buttons than it would be to drop-down lists).

Thanks!