close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart does not empty after purchase success

Thread began 1/18/2010 8:14 pm by stanforrest151613 | Last modified 2/11/2010 10:51 am by Jason Byrnes | 2078 views | 5 replies |

stanforrest151613

eCart does not empty after purchase success

Hello I have ecart successfully connecting to Authorize.net and upon success the buyer is taken to the checkout_success.php to see their receipt.

Now here's the problem, the shopping cart does not empty afetr successful pruchase, so if the buy decides to purchse more items, all items from the previous purchase are still in the cart.

How do I empty the cart after a successful purchase?

Thank You
Stan Forrest

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code to your checkout_success.php page after the </html> tag:

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

lee365928

I don't mean to thread jack, but I was about to post because I was having the same issue. I added the code you posted and it does empty my cart, but it also goes immediately to the empty cart page without displaying the order receipt. If this will confuse the original issue, I can start a new thread. I just didn't know if it was a simple fix.

Sign in to reply to this post

Jason ByrnesWebAssist

this code must be added at the very end of the page, after the closing </html> tag. If it is before the other code on the page, it will empty the cart before the anything is displayed.

Sign in to reply to this post

lee365928

I pasted the code after the /html tag and rather than go to the receipt page, it displays an empty cart. Do you have any idea what's causing this?

Sign in to reply to this post

Jason ByrnesWebAssist

on what page did you paste the code?


It must be on the receipt page after the closing </html> tag. can you send a copy of the receipt page.

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