/**
 * Implements hook_commerce_checkout_pane_info_alter().
 */
function ife_commerce_checkout_pane_info_alter(&$panes) {
  foreach ((array) $panes as $key => $pane) {
    if (!isset($panes[$key]['callbacks'])) {
      $panes[$key]['callbacks'] = array(
          'checkout_form_validate' => 'ife_form_validator',
      );
    }
  }
}

When the checkout_form_validate callback function is set, the default validation callback function for the checkout pane would no longer be active. Is there a way to fix it?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mrfelton’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
517 bytes

This fixes a glitch that prevents ife running if ANY custom callback is defined on a checkout pane. This needs more work though to also to get it to work when a custom validation handler is defined.

ipwa’s picture

Patch didn't work for me. The Shipping page form (commerce_checkout_form_checkout) works well for this module but the form that doesn't play well is the sign in form (commerce_checkout_form_authenticate).

b_sharpe’s picture

FileSize
3.03 KB

Both the original and patch don't make sense with commerce since the callbacks array is optional and can alternatively be defined by the 'base' setting appended with any of the callback names, so essentially it overwrites possibly valid callback functions.

You likely also want the IFE to work for the whole form, not just single panes. Here is a patch for this to work on the form rather than the panes. Probably can be improved as I whipped it up for my own purposes, but you get the point.

michaelmol’s picture

I have extended the patch after getting some notices and the previous patch wasn't generated correctly.

Deciphered’s picture

Rerolled against HEAD and improved. It now reads in the Commerce errors and calls form_set_error() on them so less modifications need to be made in IFE, and any form trying to rebuild ($form_state['rebuild']) will still work.

adrien.felipe’s picture

I have been using #5 for a few months now and it's working fine.
I vote RTBC

ram4nd’s picture

Status: Needs review » Fixed

  • ram4nd committed f43c621 on 7.x-2.x authored by Deciphered
    Issue #1894220 by michaelmol, mrfelton, b_sharpe, Deciphered, wayaslij:...

Status: Fixed » Closed (fixed)

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

ipwa’s picture

good job guys :)