Two related issues:
- If conditions change during an ajax submission so as to replace one set of available payment methods with another, this can produce the "An invalid option has been detected" message.
- If conditions change so as to remove ALL available payment methods, an Ajax error is generated.
The 2-part patch to follow fixes these errors.
The goal here, along with #1373236: Allow multiple modules to react on checkout Ajax events and #1518522: Update order_total when order saved is to provide a robust replacement for uc_free_order.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wodenx’s picture

FileSize
7.81 KB
longwave’s picture

Status: Active » Needs review
longwave’s picture

Shouldn't we set $order->payment_method always instead of using $default?

wodenx’s picture

FileSize
10.42 KB

Well, I guess my thought was not to alter the $order object in a 'view' callback, but it doesn't really make any difference, and I violated my own principle in #1525490: Pass payment method name to callback function., which is also fixed by doing it this way...

longwave’s picture

#4: 1524716-payment-ajax-4.patch queued for re-testing.

longwave’s picture

The drupal_goto() means that if you select (say) a country that has no payment methods available, navigate away, then try to navigate back to the checkout page, you are redirected away and aren't given the option to change your country again.

The attached patch reworks #4 so the checkout is always shown, just with a disabled radio button if no methods are available. It also simplifies and reworks some of the surrounding code to make it a bit easier to follow.

longwave’s picture

Status: Needs review » Fixed

Committed #6.

Status: Fixed » Closed (fixed)

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