Commerce Square now breaks other payment methods, when present, if the site is running version 1.4.4 of jQuery, which is the default provided by the latest Commerce Kickstart (and Drupal 7 in general). The problem is that the patch applied for issue #2927616 makes use of .prop() as a setting method, functionality that was added in jQuery 1.6. For users still on 1.4.4, this generates the error "commerce_square.form.js ... Uncaught TypeError: $form.find(...).prop is not a function". In jQuery 1.4.4, prop() is only a method for getting values.
Rather than require jQuery 1.6 use with Commerce Square (which would force users to check the rest of their site to see if anything breaks as a result of the upgrade) I believe we can fix this with a change to the script to make it backwards compatible with 1.4.4. On line 41 of js/commerce_square.form.js change:
$form.find('[name="op"]').prop('disabled', false);
to:
$form.find('[name="op"] :disabled').val(false);
I believe this achieves the same result, and it is working for me on 7.x-1.1 of this module. I'll also submit a patch in the comments.
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce_square-jquery_compatibility-2936513-1.patch | 453 bytes | DaleTrexel |
Comments
Comment #2
DaleTrexelAnd here is the promised patch. I don't do this often, so hopefully it's formatted correctly!
Comment #3
SpokjeChanging status to needs review.
Comment #4
mglamanUgh, sorry. I thought we /didn't/ break that. Thanks for patch.
Comment #6
mglamanThanks! The patch was great.
Comment #7
mglamanComment #8
DaleTrexelAwesome! Thank you for accepting the patch in the latest version. It came in just in time for the launch of my first Drupal Commerce site.
It's also my first credited contribution to Drupal code. I feel official now!
Comment #9
mglaman:D Congrats and thanks! Always appreciated. Even an investigative patch which isn't complete is always a great and welcomed start. We maintain a lot and can't always test and research every bug.