Problem Upgrading to 1.5:
In templates\tpl_checkout_confirmation_default.php
when the user clicks the Confirm Payment button, form data is sent to 4b:
1.39 sends
referencia=5&ccomercio=XXXXXX&idioma=en
but
1.5 sends
securityToken=098edf2901a446fd9baf5e1221e26316&referencia=38&ccomercio=XXXXXX&id ioma=en
The zen_draw_form function now has a security key added to the form generation.
4b expects the referencia, ccomercio and idioma fields strictly as the first, second and third fields so the inclusion of the key as the first field breaks this and causes "ERROR" to be displayed in the gateway (with no error message of course).
So, this particular form generation for this particular module needs to not include the security key.
I created a new function zen_draw_form_4b in function/extra_functions
PHP Code:
/*
* Output a form for 4b in checkout confirmation only, to not use the security token. Copied from html_output
*/
function zen_draw_form_4b($name, $action, $method = 'post', $parameters = '') {
$form = '<form name="' . zen_output_string($name) . '" action="' . zen_output_string($action) . '" method="' . zen_output_string($method) . '"';
if (zen_not_null($parameters)) $form .= ' ' . $parameters;
$form .= '>';
//if (strtolower($method) == 'post') $form .= '<input type="hidden" name="securityToken" value="' . $_SESSION['securityToken'] . '" />';
return $form;
}
and a hack in \includes\templates\MY_TEMPLATE\templates\tpl_checkout_confirmation_default.php
Change
PHP Code:
echo zen_draw_form('checkout_confirmation', $form_action_url, 'post', 'id="checkout_confirmation" onsubmit="submitonce();"');
to
PHP Code:
if ($_POST[payment]== 'Qb_ZhenIT') {// to send form minus security token to 4b
echo zen_draw_form_4b('checkout_confirmation', $form_action_url, 'post', 'id="checkout_confirmation" onsubmit="submitonce();"');
} else {
echo zen_draw_form('checkout_confirmation', $form_action_url, 'post', 'id="checkout_confirmation" onsubmit="submitonce();"');
}
I have tidied-up this module quite a bit but due to lack of interest in Zen Cart in Spain, tidying it up for public consumption, documenting and uploading a new version is not on my to-do list at the moment.
If anyone wants a copy please pm me.
Note that the "updated version" available from the original authors site uses code for OScommerce with a compatibility/translation file for Zen Cart functions.
I can't say if it works or not on a default installation (1.39) as the code was so ugly to my eyes I couldn't bear to mix it with my cart!
Bookmarks