Currently, when an item is completely out of stock, the "add to cart" button is disabled and replaced with a non-functional "out of stock" button. Unfortunately, this only occurs on the product page view -- all other locations (such as the catalog pages, etc), the "add to cart" button is still active.
This can be fixed by changing line 60 of uc_attribute_stock_filter.module from:
if (ereg('^uc_product_add_to_cart_form_', $form_id)) {
to:
if ($form['submit']['#value'] == variable_get('uc_product_add_to_cart_text', t('Add to cart')) && $form['nid']['#value']) {
This causes the "add to cart" button to be disabled for an out of stock product in all locations.
I borrowed this code from line 18 of the Ubercart Price Quotes module (http://drupal.org/project/uc_quotes), so you may need to add in a comment with the proper copyright info for licensing purposes.
I've tested this change throughout my site, and haven't found any side effects, so I think it is safe to implement.
Comments
Comment #1
henrrrik commentedI'll look into this. Form detection by submit button text seems a bit unorthodox, checking for the catalog form id might be preferable.
Everything on drupal.org is licensed under GPL v2, so that's never an issue.
Comment #2
henrrrik commentedComment #3
TwistedLincoln commentedIf you check for the catalog form id, would it still work in custom blocks created by Views2? Checking for the submit box test is pretty silly, I admit, but it works in any location the button might be displayed, rather than just ones that are specified.