Closed (fixed)
Project:
Ubercart AJAX Cart
Version:
6.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2012 at 12:42 UTC
Updated:
14 Jun 2012 at 00:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
nelslynn commentedI've encountered something similar, only that after the first time to the cart page, and trying to change quantity, it dosn't work, althougth there is a successful update message. It takes a few times for the update cart to then work. After it works once, I can browse away from the cart page and then back to it, and the update function works as expected.
I've cleared cache, run update, and run cron.... neither of these help.
Using latest version of Dev uc_ajax-cart (jan 24) and ubercart 2.7
Comment #2
neilnz commentedThe reason for this is Ubercart 2.7 includes a hidden submit button at the top of the form that has the same ID (edit-update) as the one at the bottom. Of course this is extremely invalid, but to trigger the cart submit on change, triggerCartSubmit() in uc_ajax_cart.js uses this:
jQuery('#uc-cart-view-form #edit-update').trigger('click');Because this actually matches two elements (!!), it clicks both update buttons. The first submit has valid form data, the second doesn't, and it triggers two refreshes of the cart contents, the first before the update has actually happened. It leads to a race condition, which is why the update works sometimes.
While Ubercart really need to sort out their CSS IDs on the form, this can be worked around by changing the click trigger to:
jQuery('#uc-cart-view-form #edit-update:first').trigger('click');Attached a patch that does this.
Comment #3
tunic#2 sounds good to me... nelslynn, Bartezz, could you test attached patch and post your results?
Comment #4
bartezz commented@tunic, will try! But am currently not working for that employer anymore, will have to setup a copy of the site and test, don't hold your breath!
Comment #5
stewart.adam commentedHas an issue been reported against Ubercart about this? While I'll be happy to commit this in the mean time (after RTBC), this should really be fixed in Ubercart not here...
Comment #6
nelslynn commentedSorry, this patch does not fix the problem for me.
EDIT, this seems to fix the issue when using Ubercart 2.8, just released.
Comment #7
stewart.adam commentedJust got a chance to test this, confirmed working.
Committed, thanks.