Same like here: http://drupal.org/node/779968
The Back button on the review order page leads to the Payment Gateway instead of going back. This really needs a fix.

Comments

tinny’s picture

My work around:


function mymodule_form_alter(&$form, &$form_state, $form_id) {
    // Remove the regular buggy back button because it was submitting the form instead of redirecting to previous page
    if ($form_id == 'uc_cart_checkout_review_form') {
        unset($form['actions']['back']);
    }
    // Create a new back button that redirects to the previous page
    if ($form_id == 'uc_migs_form') {
        $form['back_submit'] = array(
        '#type' => 'submit',
        '#value' => t('Back'),
        '#submit' => array('mymodule_form_alter_back'),
        );
    }
}

function mymodule_form_alter_back($form, &$form_state) {
    // this url is hardcoded as $form_state['storage']['base_path'] doesnt exist for some reason
    // see: line 504 @ sites/default/modules/contrib/ubercart/uc_cart.pages.inc
    $form_state['redirect'] = 'cart/checkout';
}
mstrelan’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.76 KB

The currently implementation of adding a form to the existing form means that only the added form is submitted. Not only is the back button broken, any additional validation (such as a terms & conditions checkbox I had added) is bypassed.

Attached patch merges the additional form values in to the existing form, adds the submit handler and overrides the submit button text. The back button and form validation appear to work correctly.