close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Shopping cart not clearing after checkout

Thread began 6/12/2010 10:05 am by dave403891 | Last modified 6/16/2010 9:54 am by Jason Byrnes | 1445 views | 11 replies |

dave403891

Shopping cart not clearing after checkout

When the checkout process is complete and the emails have all been sent, the next person trying to place an order finds all the products from the previous order still in the shopping cart. It doesn't matter if this is the same customer placing an additional order or someone new visiting the site. There is no site login.

What additional code do I need to add to get the cart to clear? Do I add it to the checkout_success page?

Ideally, the trigger here would be a return to the index page or leaving the site.

I know this is a simple task, but being so new to PHP it is still beyond me. I checked out the previous thread from pmait97856, but it was not clear to me what to do.

Thanks for your help.

Sign in to reply to this post

Jason ByrnesWebAssist

add thje following code to the checkout success 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

dave403891

Jason,

As usual brilliant! I don't know why I thought my situation was so unique. Learning continues

But, I just noticed something else that I can't fathom. When anyone on the checkout page checks the "Same as billing address" checkbox. The shipping address does not populate nor does it appear on the confirm page. What do I have to learn here?

Also, should I start a new thread when I have another issue like this?

Sign in to reply to this post

Jason ByrnesWebAssist

try it in Fire Fox after clicking the same As Billing check box, go to Tools -> Error Console to see if there are any javascript errors being logged.

can you post a link to the checkout page?

Sign in to reply to this post

dave403891

Jason,

Did as you asked and here is the error message

Error: eCart_copyBillingToShipping is not defined
Source File: checkout.php
Line: 1

The link is listed in the error message. Hope this helps solve the puzzle.

Sign in to reply to this post

Jason ByrnesWebAssist

your checkout page is missing the following script tag:
<script src="WA_eCart/Scripts/copyShipping.js" type="text/javascript"></script>

it should be just before the closing </head> tag

Sign in to reply to this post

dave403891

Jason,

Thanks. That worked but instead of the confirm page rendering, I got this message:

Duplicate entry '0' for key 'PRIMARY'

What does it mean and how do I fix it?

Sign in to reply to this post

Jason ByrnesWebAssist

the primary key for either the orders table or the order details table is not set to Auto Number.

Double Check that the order and order details table primary columns are both set to Auto number.

Sign in to reply to this post

dave403891

Everything renders, but I have this warning below the footer on the checkout_success page:

Warning: Cannot modify header information - headers already sent by (output started at /home/davcow9/InnerchoicePublishing.com/checkout_success.php:192) in /home/davcow9/InnerchoicePublishing.com/checkout_success.php on line 273

Line 273 is noted below in the additional code we added to get the cart page to empty:

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

One other thing, the email receipt is not generating as it was before.

// 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"]
// This is line 273 );
}

// Finally, destroy the session.
session_destroy();
?>

Sign in to reply to this post

Jason ByrnesWebAssist

change that line to:

php:
@setcookie(session_name(), '', time() - 42000,

        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]
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...