With Inventory Control enabled for subproducts, out of stock subproducts are allowed to be added to the cart even if the stock level is zero.

Attached patch resolves the issue for me.

Comments

TheRevolution.US’s picture

I added this patch to my 4.7 version. Seems to work so far but someone should verify that there's no need for any changes from the 5.x version

djflux’s picture

Also check out the patch at this issue: http://drupal.org/node/130980

Both apply cleanly to the 2007-05-11 tarball of 5.x-3.x-dev and validate item inventory (stock) before adding the item to the cart.

TheRevolution.US’s picture

This does keep products that are already sold out from being added to the cart but there are three loopholes that will still add more items to cart than there are items in inventory. For these examples assume there is one item in inventory and you have already added it to your cart.

One way to add an extra item is by simply clicking the "add to cart" button again.

The second way is by clicking the "add" link in the "Products in cart" area which appears after adding the initial item.

The third is by updating the "quantity" field on the cart page.

Each of these allow for someone to accidentally add more items than are in inventory, therefore making this patch barely better than unpatched. This has been outstanding for a long time and I would love to see this fixed as it makes the entire ecommerce package unusable to people selling things in limited quantities, such as myself.

Thanks, Eric

djflux’s picture

Eric,

Check out this comment:

http://drupal.org/node/130980#comment-256792

Basically not decrementing inventory after adding to cart (I believe) was a design decision. There are two schools of thought. Check out the comment above for more details

brmassa’s picture

Project: e-Commerce » eC Live Subproducts
Version: 5.x-3.x-dev » 5.x-2.09
Component: subproducts » Code
Assigned: Unassigned » brmassa
Status: Needs review » Fixed

Guys,

EC Live Subproducts (an advanced subproducts module) deals with this problem already. I suggest to use it instead the original subproducts. It is going to be merged to original subproducts on the next ecommerce version, v4. So you will have full support.

regards,

massa

brmassa’s picture

Status: Fixed » Closed (fixed)
Thomas Sewell’s picture

See also http://drupal.org/node/119230#comment-711738 for a combined patch that includes fixing the update cart button.