close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Clearing basket on success page

Thread began 3/26/2011 1:23 pm by josephman1988419833 | Last modified 4/01/2011 6:37 am by Jason Byrnes | 2418 views | 9 replies |

josephman1988419833

Clearing basket on success page

Hi guys,

Somethings' happening on the checkout success page that's not allowing the basket to empty.

I'm sure there's a way to do this with a session destroy or something similar.

Can someone point me in the right direction?

Thanks,
Joe

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code after the cosing </html> tag on the success page:

php:
<?php

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

// 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(true);
?>
Sign in to reply to this post

josephman1988419833

Worked like a charm,

Many thanks again, again, again =]

Sign in to reply to this post

josephman1988419833

Also, how does the verification process work?
Because at the moment this page also sends to the db that the order has been completed, but obviously the user can bypass this by going straight to the checkout_success.php page.

Surely sagepay sends back a transaction id, if this exists then the payment has been accepted?
Is this the case or do I have to do something funky to get this working?

Thanks again.

php:
<p class="eC_OrderInfo">SUCCESS: <?php echo $_SESSION["Protx_VSPServer_Success"]; ?><br />

        STATUS CODE: <?php echo $_SESSION["Protx_VSPServer_StatusCode"]; ?>        <br />
        ERROR MSG: <?php echo $_SESSION["Protx_VSPServer_ErrorMessage"]; ?>        </p>
        <p class="eC_OrderInfo">COPIED CODE...<br />
Success: <?php echo $_SESSION["Protx_VSPServer_Success"]; ?><br />
Status code: <?php echo $_SESSION["Protx_VSPServer_StatusCode"]; ?><br />
Error message: <?php echo $_SESSION["Protx_VSPServer_ErrorMessage"]; ?><br />
Bug report:
Success: <?php echo $Protx_VSPServer_Auth["Success"]; ?><br />
Status code: <?php echo $Protx_VSPServer_Auth["StatusCode"]; ?><br />
Error message: <?php echo $Protx_VSPServer_Auth["ErrorMessage"]; ?><br />
Vendor trans code: <?php echo $Protx_VSPServer_Auth["VendorTxCode"]; ?><br />
SagePay Trans ID: <?php echo $Protx_VSPServer_Auth["VPSTxId"]; ?><br />
Security Key: <?php echo $Protx_VSPServer_Auth["SecurityKey"]; ?><br />
Next URL: <?php echo $Protx_VSPServer_Auth["NextURL"]; ?><br />
Full response: <?php echo $Protx_VSPServer_Auth["FullResponse"]; ?><br />
Full request: <?php echo $Protx_VSPServer_Auth["FullRequest"]; ?></p>         
        </p>



None of these exist on the page you see ...

Sign in to reply to this post

Jason ByrnesWebAssist

in another thread:
showthread.php?t=19696


you report that you are using the VSP Form Method, the code you posted here is using the VSP Server method?

Sign in to reply to this post

josephman1988419833

Yes that is correct, after this post I noticed the 'server' in the variable names.
Going through some tutorials I still can't find a way to access these variables.

Surely using the VSP Form we can still get these values?

Thanks for your reply.

Sign in to reply to this post

Jason ByrnesWebAssist

On the bindings panel, click the plus button and select eCart -> Checkout -> Checkout Form response.

from the list of gateway's select Sage Pay VSP Form

Sign in to reply to this post

josephman1988419833

These print out absolutely nothing going through to the checkout success page:

php:
<?php echo((isset($Protx_VSPForm_Bindings["Status"]))?$Protx_VSPForm_Bindings["Status"]:""?> <br />

        <?php echo((isset($Protx_VSPForm_Bindings["StatusDetail"]))?$Protx_VSPForm_Bindings["StatusDetail"]:""?><br />
        <?php echo((isset($Protx_VSPForm_Bindings["Amount"]))?$Protx_VSPForm_Bindings["Amount"]:""?>
        <?php echo((isset($Protx_VSPForm_Bindings["VendorTxCode"]))?$Protx_VSPForm_Bindings["VendorTxCode"]:""?>
        <?php echo((isset($Protx_VSPForm_Bindings["VPSTxId"]))?$Protx_VSPForm_Bindings["VPSTxId"]:""?>
        <?php echo((isset($Protx_VSPForm_Bindings["TxAuthNo"]))?$Protx_VSPForm_Bindings["TxAuthNo"]:""?>



Its fairly confusing ..
Thanks for your help so far.

Sign in to reply to this post

josephman1988419833

Ahhh, found the problem.

Basically the password on the checkout button was different then the password on 'vspform.php'...

Ah well, problem solved!

Thanks :D

Sign in to reply to this post

Jason ByrnesWebAssist

excellent, glad to hear it is working.

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...