Needs review
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Cart
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2013 at 15:41 UTC
Updated:
31 Oct 2016 at 20:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedHere's a oneline patch.
Comment #3
rszrama commentedWhy shouldn't it trigger validation? It's a submit button on the form, and if someone changes a quantity on another line item I wouldn't want their value to be lost by removing something else in the cart. So I'd say this is by design, but if you had a rationale for the change I'd be happy to entertain it.
Obviously, if this were just a delete button at the bottom of a line item entity form, we'd want it to limit validation errors. But as just one element of many on a form, I don't see why we would. I may be misunderstanding the form, though - perhaps it's using a button level submit handler so quantity values wouldn't be saved anyways?
Comment #4
bojanz commentedExactly.
EDIT: Hm, I was wrong. Right now clicking Delete will save other quantities. However, I consider that to be wrong. If you didn't update your cart, Delete shouldn't be doing that for you.
Comment #5
rszrama commentedAhh, interesting. It's how the "Checkout" button works, too.
Comment #6
bojanz commentedHere is a smarter patch.
Effects:
1) Delete doesn't trigger validation errors. It just removes the row. Quantities are not updated.
2) Quantities are updated when one of the main buttons is clicked (Update cart, Checkout)
Comment #7
jsacksick commentedRerolled patch against dev.
Comment #8
rszrama commentedI'm still not sure I understand this change unless we introduce #ajax functionality to allow a delete button to be clicked without other data loss on the form. My observation about this being a compound form vs. a single item form still informs my opinion here - I don't think we can expect people to only make one update related operation at a time (i.e. delete vs. a quantity change vs. whatever else someone might put in this form).
Comment #9
bojanz commentedHere's a reroll for Marketplace.
I don't have a strong argument for or against. It's just what Allison and Aaron (if I'm not mistaken) thought to be expected behavior.
Comment #10
bojanz commentedComment #11
ETENTION commentedMy mistake. Didn't watch the debug data close enough and got mixed up with another module.
And this patch seems to work.
Comment #12
kentr commented+1 for some change to this behavior.
My use-case is:
Checkout form (at
checkout/<order-num>/checkout) with aDeletebutton and noQuantitycolumn in the line items. Only 1 of any item can be purchased, soQuantityisn't applicable.Clicking
Deletecauses the form to throw validation errors b/c the billing information is empty.Comment #13
kentr commentedFor me, looks like the
Deletebutton is actually triggering form submission and checkout completion.IOW, after completing the billing information fields to sidestep the validation problem, hitting the
Deletebutton submits the form, completes the checkout and purchases the item which should have been deleted.To me, that's a bug...
Regardless of whether or not the user information is lost when this button is clicked, I don't think this button should trigger checkout. There are special handlers for other buttons to avoid processing orders (
commerce_checkout_form_back_submit(),commerce_checkout_form_cancel_submit()) -- it seems this button needs one as well.Comment #14
kentr commentedComment #15
bojanz commentedYou are trying to embed a cart form into a checkout form. There's simply no way for that to work, HTML itself won't support it.
That's why you get checkout completion, Drupal is confused about which form is actually submitted.