If you chose the option “Display a textfield quantity widget on the add to cart form.” You can sometimes add a quantity that’s larger then the stock level.

The code currently has two separate paths:

One is for multiple products per display, I hope I fixed that one in http://drupal.org/node/1182384#comment-4638436

The second is when you only have one product or are using attributes to select your product like colour and size, and that’s the one that needs fixing.
so:
Stock: 1
product X quentity: 50 add to cart
=you have 50 x items in your cart

I am hoping to get a chance to look at this at some stage as I am beginning to be familiar with that code

Comments

guy_schneerson’s picture

Patch to add quantity validation for the above issue

rfay’s picture

Status: Active » Needs review

I ran into this yesterday. You're doing awesome work!

Would you consider comaintaining this module?

guy_schneerson’s picture

Yes would love to. I also have some ideas about what we could do with it in the future, I think it can be refactored to be rules based.
I am happy with working with the code, the only thing is I am not experienced with is the mechanics and logistics of maintaining/co-maintaining but am happy to learn.

rfay’s picture

Thanks - you now have commit and project access!

There are some guidelines at http://drupal.org/node/363367

What I ask:

1. In general, work transparently in the issue queue, even if nobody else comments. But give them a chance to, and make it obvious what you're doing.
2. Subscribe to all issues, so you get notified early about problems.
3. Introduce fixes, not bugs :-)

Yay! Thanks so much.

guy_schneerson’s picture

Will spend some time tomorrow or Monday getting familiar with things

rfay’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.x-dev
Status: Needs review » Needs work

This patch seems to be broken - can you reroll please

$ git apply add-to-cart-quantity-validation-1196724-1.patch
add-to-cart-quantity-validation-1196724-1.patch:20: trailing whitespace.
      $form['#validate'][] = 'commerce_stock_add_to_cart_validate'; 
fatal: corrupt patch at line 28
guy_schneerson’s picture

Sorry will do

guy_schneerson’s picture

This should work fine

I created two new git repositories one for developing and creating the patches and one for testing and committing the patches. Also got a site to test the patched file on

Please let me know if this patch is ok.
I will go over all my other patches and recreate them using this pattern to make sure they are ok.

rfay’s picture

It does apply fine - thanks! Hope to be able to test it today.

rfay’s picture

Status: Needs work » Needs review
guy_schneerson’s picture

tested it on commerce rc1 - and works fine for me

guy_schneerson’s picture

Status: Needs review » Fixed

commited: cbf94ba

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.