Re: Stock button not working

gajillion's picture
Offline
Joined: 08/25/2007
Juice: 70
Re: Stock button not working
Quote:

I missed that a product with no attributes, and a stock level of 0 (zero), the button appears as "add to cart". But when you click that, it goes to the next page and says:

"Sorry, there is not enought in stock to add this to your cart."

Trevor - having just run through this myself, this is caused because the module makes the assumption that you will be using "Product Adjustments" when you have attributes. From the comments in uc_inventory_api.module:

/**
* For products that have attributes there will be Sub-Products, one model (SKU)
* for every combination of attributes. This function retrives a list of these
* for the given Node ID
*
* @param
*   Product Node ID
*
* @return
*   Array of sub products, empty array if the product has no attrributes
*/
function uc_inventory_api_get_subproducts($nid)

However, it's not necessarily the case that you will want to use adjustments (as was my case) and products that don't use "adjustments" will not have sub products, and every product with that attribute will have the same SKU. That's why this fails. If you go in and add a unique SKU for each attribute the module will check stock correctly.

Inventory API & Simple Stock Levels By: CpILL (139 replies) Fri, 08/10/2007 - 08:33