Problem: Increasing quantity of product in cart using update cart for registration enabled product, allows user to register more spaces than currently available.
To recreate:
Manage Registrations -> Settings -> Set Capacity.
(for illustrative purposes, set to 2)
View the page/product with registrations enabled. Add to cart.
Navigate to the "cart". Change quantity of the product which is larger than the available slots.
For illustrative purposes, set here to say 3.
Cart will update. Checkout process will allow submitting the order and completion even though system has essentially overbooked.
Comment | File | Size | Author |
---|---|---|---|
#3 | items-removed-from-cart-in-admin-view-of-orders.png | 49.75 KB | rparree |
Comments
Comment #1
aj2 CreditAttribution: aj2 commentedI'm not sure of the proper solution (and this solution seems inefficient), but here is the code I used to solve the problem. Sharing in case it is of use to somebody and also in hope that someone might be able to improve it.
Disclaimer: this is the first drupal module code I've ever written.
Comment #2
rparree CreditAttribution: rparree commentedThanks for posting this!
I am testing your code in our site as well. Did you since December made any changes to the code?
Comment #3
rparree CreditAttribution: rparree commentedI had an order which caused the event to get overbooked (before i used the code above). When i went to that order in the admin view, the script removed the registrations with the message "There are only -1 available slots for Xxx. Items was removed from your cart" (in this case 4 times)
I guess the status of the order was still "Shopping Cart". But just sharing in case there might be an issue
Comment #4
laughnanSubscribing.
Comment #5
maxplus CreditAttribution: maxplus commentedHi,
great for the cart update.
But I think there is also a problem on the initial add to cart action.
You can also overbook there.
If you have for example 1 space available, I can just add 3 items to my cart without getting a notice.
After the checkout is complete, you see that your event is overbooked without a single message.
The only capacity limit that I see that is working, is that if there are no spaces available anymore, you cannot add a single item to the cart, you get the message that no registrations are available at the moment.
Comment #7
blacklabel_tom CreditAttribution: blacklabel_tom commentedHi All,
This has been merged into the dev branch: http://cgit.drupalcode.org/commerce_registration/commit/?id=e3d1c99
I've attempted to give credit, let me know if it doesn't appear on your profile.
Cheers
Tom
Comment #10
aj2 CreditAttribution: aj2 commentedProbably a good idea to add a check to verify if registration is possible as a third pass.
For example:
Comment #11
blacklabel_tom CreditAttribution: blacklabel_tom as a volunteer commentedComment #13
blacklabel_tom CreditAttribution: blacklabel_tom as a volunteer commentedHi Aj2,
Added your third pass to the dev branch.
Cheers
Tom