Back button on review order page doesn't work
gsquirrel - August 19, 2009 - 17:03
| Project: | UC Worldpay |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
I see that this is mentioned on a different issue http://drupal.org/node/367935 but since it is specific thought it better to add as a new issue rather than comment there.
I wonder if there has been any change on this, or if anyone has more information on why the back button doesn't work.
On my install it sends the user to a worldpay page with the error "Sorry, there was an error in the processing of this payment.", seems like it is trying to complete the order (and fails) rather than going back to the cart or the checkout page.
Has anyone else found a workaround for this issue?

#1
This bug is still there in 2.0. Is there chance of a fix soon?
#2
I'll have a look at this evening.
#3
By the way in the end i just made a new button and hid the old one as a workaround for the site i was working on.
It was just a javascript back, probably a nasty workaround but i needed something that worked.
#4
I've attached a patch which requires testing. To test it you'll need to checkout the HEAD version of uc_worldpay and then apply this patch. Let me know if it works for you :)
#5
Hi, I tried out the patch on the HEAD version of uc_worldpay.module - it fixed the back button but now the following WorldPay error occurs when I press the Submit Order button..
Sorry, there was an error in processing this transaction:
The information sent from the merchant's site is invalid or incomplete. Please send the following information to the merchant:
The transaction cannot be processed due to one or more of the following:
* the installation ID field is blank or contains invalid characters
* a different submission protocol is required. For instance, a more secure submission may be required
* the installation number is invalid
It could be that I've done something wrong, but I was wondering whether it was because the patch uses a URL redirect to WorldPay rather than a form POST and so none of the WorldPay parameters are being passed, like the installation ID.. However, I'm still learning the Form API and am not sure how to fix it..
gsquirrel - just wondering whether it was possible to see how you did your javascript hack so that I can try that route for the time being.. Thanks.
#6
Thanks willowmedia, so it's back to the drawing board on this one. I was working in the dark in that I wasn't able to test it thoroughly as I don't have a developer account at RBS yet, (hence the tentative patch), hopefully that will get sorted out soon and I'll be able to come up with a fix.
#7
Changed status
#8
Hi - I will look it up and post - was using a theme function i think and css to hide old not working button.
But also there have been some changes at worldpay lately - I had to change the url in the uc_worldpay.module so it could be the error is related to that instead?
changed $live_server = 'https://select.worldpay.com/wcc/purchase';
to $live_server = 'https://secure.wp3.rbsworldpay.com/wcc/purchase';
#9
This has been updated in HEAD, I would recommend using that until we get a new release out.
#10
This is the theme override function I used in template.php - with "theme" changed to theme name:
function theme_uc_cart_checkout_review($panes, $form) {
drupal_add_css(drupal_get_path('module', 'uc_cart') .'/uc_cart.css');
$output = '<p>'. check_markup(variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')), variable_get('uc_checkout_review_instructions_format', FILTER_FORMAT_DEFAULT), FALSE)
.'</p><table class="order-review-table">';
foreach ($panes as $title => $data) {
$output .= '<tr class="pane-title-row"><td colspan="2">'. $title
.'</td></tr>';
if (is_array($data)) {
foreach ($data as $row) {
if (is_array($row)) {
if (isset($row['border'])) {
$border = ' class="row-border-'. $row['border'] .'"';
}
else {
$border = '';
}
$output .= '<tr valign="center"'. $border .'><td class="title-col" '
.'nowrap>'. $row['title'] .':</td><td class="data-col">'
. $row['data'] .'</td></tr>';
}
else {
$output .= '<tr valign="center"><td colspan="2">'. $row .'</td></tr>';
}
}
}
else {
$output .= '<tr valign="center"><td colspan="2">'. $data .'</td></tr>';
}
}
$output .= '<tr class="review-button-row"><td colspan="2">'. '<input type="button" value="Go Back" onclick="history.go(-1);return false;" />' . $form .'</td></tr></table>';
return $output;
}
The bit that does the button is the last line added to the output:
$output .= '<tr class="review-button-row"><td colspan="2">'. '<input type="button" value="Go Back" onclick="history.go(-1);return false;" />' . $form .'</td></tr></table>';#11
I've just found out that my client is happy for the back button to be removed altogether! - so thanks gsquirrel I don't need the js hack now.
In the meantime, I'll update my RBS worldpay URLs as advised and I've used the following one-liner (erm, I guess hack) in form_alter to hide the back button..
unset($form['back']);#12
willowmedia, no kittens were harmed, an unset in hook_form_alter() is not a hack ;)
#13
:-) thanks matason.. and thanks for the code gsquirrel, I think our posts crossed, I'll bear it in mind though for another site I've got brewing..
#14
Committed a fix - http://drupal.org/cvs?commit=292352