cre loaded – enctype=”multipart/form-data” and payment modules, sagepay form

Cre Loaded version 6.4.1 still widley uses enctype=”multipart/form-data” for form submission. This would be ok if the forms being submitted involved file uploads or large files, but when payment module forms get zapped with this ‘decoding’ routine, they tend to break. A case in point – the Sagepay Form module.

The code responsible is in templates/content (or /templates/your template/content) and the file is checkout_confirmation.tpl.php (around line 277 in the CE version) :

if (ACCOUNT_CONDITIONS_REQUIRED == 'false' ) {
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post','enctype="multipart/form-data"');
} else {
echo tep_draw_form('checkout_confirmation', $form_action_url, 'post','onsubmit="return checkCheckBox(this)" enctype="multipart/form-data"');
}

and replace with this :

if ((ACCOUNT_CONDITIONS_REQUIRED == 'false' ) && ($_SESSION['payment'] == 'sage_pay_form')) {
            echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
          } elseif ((ACCOUNT_CONDITIONS_REQUIRED == 'true' ) && ($_SESSION['payment'] == 'sage_pay_form')) {
            echo tep_draw_form('checkout_confirmation', $form_action_url, 'post','onsubmit="return checkCheckBox(this)"');
          } elseif (ACCOUNT_CONDITIONS_REQUIRED == 'false') {
            echo tep_draw_form('checkout_confirmation', $form_action_url, 'post','enctype="multipart/form-data"');
          } else {
            echo tep_draw_form('checkout_confirmation', $form_action_url, 'post','onsubmit="return checkCheckBox(this)" enctype="multipart/form-data"');
          }