close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

cart session not clearing after checkout

Thread began 8/25/2009 8:07 am by vela1606379889 | Last modified 9/09/2009 11:52 am by Jason Byrnes | 2975 views | 3 replies |

vela1606379889

cart session not clearing after checkout

after getting the checkout_success.php, I am able to see the cart content.
I guess the checkout process is not clearing the cart session.

how can i fix this?

Thanks in advance...

Sign in to reply to this post

Jason ByrnesWebAssist

If you are using PHP, add the following at the bottom of 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 (isset($_COOKIE[session_name()])) {
    @
setcookie(session_name(), ''time()-42000'/');
}

// Finally, destroy the session.
session_destroy();
?>
Sign in to reply to this post

joe159765

Possible?

is it possible to easily remove the cart items without resetting ALL session variables? This way logs the person out.

Sign in to reply to this post

Jason ByrnesWebAssist

The idea is that you want to start a new session with a new session ID.


you could store some session variables into application variables, destroy the session, then reset them in the new session. For example, if the users login is tracked by a session variable name UserID:

php:
<?php

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

//store the UserID Session Variable
if(isset($_SESSION['UserID']) && $_SESSION['UserID'] != "") {
  
$UserID $_SESSION['UserID'];
}

// 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 (isset($_COOKIE[session_name()])) {
    @
setcookie(session_name(), ''time()-42000'/');
}

// Finally, destroy the session.
session_destroy();
@
session_start();
//Reset the UserID Session Variable
if(isset($UserID) && $UserID != "") {
   
$_SESSION['UserID'] = $UserID;
}
?>
Sign in to reply to this post

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