close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Worldpay redirect to shop site

Thread began 7/11/2012 11:57 am by bill3786 | Last modified 7/13/2012 7:09 pm by bill3786 | 13041 views | 9 replies |

bill3786

Worldpay redirect to shop site

Been looking at worldpay help documents to add either

1. An automatic redirect to a succes or failure page on the shop site after a purchase

or

2. Adding a redirect button on the worldpay results page to give the customer an option to return to the site.

The worldpay documentation is not easy to follow so would welcome some advice on how to achieve either option and also which would be the easiest to achieve.

Also, will the cart contents still be displayed or cleared when directed back to the shop site.

Sign in to reply to this post

Jason ByrnesWebAssist

I found this through google that should help you in adding a link back to your site on the worldpay thank you page:

index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=99

Sign in to reply to this post

bill3786

Thanks Jason.

Looked into this and its describing the editing of the worldpay payment page rather than the results page. The results page is the last worldpay page displayed and this is where I believe the redirect should take place.

It seems that you have to download a worldpay success file called resultY.html then add a meta-refresh or a static redirection url and upload the amended file back again. Does this sound familiar to you? The worldpay documentation is not user friendly.

This can redirect to a "thankyou for ordering" type page to display to the customer.

When the customer is redirected to this page does any code need to be added to the page to clear the cart, if so, what is it?

A manual redirect to the shop after the worldpay results page still shows the cart contents.

Sign in to reply to this post

bill3786

After contact with worldpay the inclusion of a meta refresh on their resultY.html page now works well and redirects to the shop site.

However, what is the best way to keep the customer logged in, but empty the cart, after the redirect to the success page on the site?

Is it done by adding a simple clear cart function or something more complex?

Sign in to reply to this post

Jason ByrnesWebAssist

you need to destroy the session completely to start a new browsing session.

to maintain the users logged in state, you will need to store the user sessions into application variables, then destroy the session and reset the user session variables


take a look at your login page. Double click the authenticate user server behavior, and go to the third page. Make note of all of the session varaibles that are set here.

now on the success page use the following code:

php:
<?php

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

//store user sessions - create a application variable for each user session variable from the login page
$userID $_SESSION['userID'];
//add more application variables if you need to


// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    
$params session_get_cookie_params();
    @
setcookie(session_name(), ''time() - 42000,
        
$params["path"], $params["domain"],
        
$params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
session_destroy();
@
session_regenerate_id();

//restore the users session variables
$_SESSION['userID'] = $userID;
?>



make sure to use the correct sesssion names in the store user session section

Sign in to reply to this post

bill3786

I've added the two extra session variables that are set from the login page and added the code to the success page.

After the worldpay redirect to the success page the quickcart in the header still shows the number of items and total from the purchase. However if "view cart" is clicked this is cleared to zero.

Is it possible to have the quickcart reset to zero as the page loads?

Success page is attached.

Attached Files
success.zip
Sign in to reply to this post

Jason ByrnesWebAssist

add the code I gave you at line 1 rather than at the end.

Sign in to reply to this post

bill3786

Ok, moved the code to line 1 and this causes the quickcart in the header to disappear on page load after redirect from worldpay.

Logging in again returns the quickcart empty.

The system is set up so that the quickcart is only displayed for UK users, who then use the worldpay checkout. Non UK users are not shown an "add to cart" in the header or anywhere else and are instructed to phone in their orders. This system is working perfectly so far.

Ideally would like the return to the success page from worldpay (UK users only) to display the quickcart empty on page load. Is this possible?

Modified success page attached.

Attached Files
success.zip
Sign in to reply to this post

Jason ByrnesWebAssist

try adding @session_start(); just before resetting the session variables:

@session_start();
$_SESSION['SecurityAssist_UserID'] = $userID;
$_SESSION['UserLevel'] = $userLevel;
$_SESSION['UserCountry'] = $userCountry;

Sign in to reply to this post

bill3786

Yes, that did the trick.

Many thanks.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...