/**
* 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?

Comments

mrfelton’s picture

Issue summary:View changes
Status:Active» Needs review
StatusFileSize
new517 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

StatusFileSize
new3.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

StatusFileSize
new1.72 KB

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.