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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DaleTrexel created an issue. See original summary.

DaleTrexel’s picture

And here is the promised patch. I don't do this often, so hopefully it's formatted correctly!

Spokje’s picture

Status: Active » Needs review

Changing status to needs review.

mglaman’s picture

Ugh, sorry. I thought we /didn't/ break that. Thanks for patch.

  • mglaman committed a53be0b on 7.x-1.x authored by DaleTrexel
    Issue #2936513 by DaleTrexel: Multiple Payments Now Broken in jQuery 1.4...
mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! The patch was great.

mglaman’s picture

Status: Reviewed & tested by the community » Fixed
DaleTrexel’s picture

Awesome! 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!

mglaman’s picture

: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.

Status: Fixed » Closed (fixed)

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