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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Clearing cart contents on success page

Thread began 7/15/2013 11:31 am by Jon Cunningham | Last modified 7/15/2013 3:41 pm by Jason Byrnes | 630 views | 16 replies |

Jon CunninghamBeta Tester

Clearing cart contents on success page

Hi Guys,

I know that this has been talked about on the forums but every solution i have tried fails to work.

Background.

Front end shopping cart works fine. I also have a secondary shopping cart in the admin side to add order's to the database if items are purchased off site.

This works well except

When you put an order through the cart keeps the previous shopping details.

Solution i have tried also destroys the login session so i have to log back in after checkout which is not a desirable outcome, but the cart is cleared.

If anyone can help it would be greatly appreciated.

Kind regards

Jonathon

Added my Confirm and Checkout success pages.

I have also noticed that when checking out that it over writes the last order. I am guessing that its not clearing the user session variables also.

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

Jason ByrnesWebAssist

Look at your login page to determine the sessions that are created at login.

on the checkout success page, edit the Clear Session behavior, instead of selecting the clear all option. Select to clear only some, and leave the sessions set by the login un selected.

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

I have quite a list of session variables. As can be seen from the screen grab.

As opposed to listing all of the sessions to clear and leaving the session left by the log in (SecurityAssist_SiteSettings), Is there a way to select the log in and clear the rest?

if not, what would be the sessions I need to clear from the attached screen grab.

Kind regards

Jonathon

Sign in to reply to this post

Jason ByrnesWebAssist

No there is not a way to select only the ones to keep, you can only select the ones to clear.

you select all of the seessions that are not associated to the login.

the only other option is to hand code the session destroy. Doing this, you will need to set the login sessions to an application variable, then reset them after clearing, for example:

php:
<?php

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

// save User ID session
$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 (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();
//reset user id session
$_SESSION['UserID'] = $UserID;
?>
Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

I get a syntax error when I paste this code into DW.

$_SESSION = array(); is highligted

and this is my code

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

// save User ID session
$UserID = $_SESSION['SecurityAssistSiteSettingsID']

// 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();
//reset user id session
$_SESSION['SecurityAssistSiteSettingsID'] = $UserID;
?>

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, this line:
$UserID = $_SESSION['SecurityAssistSiteSettingsID']

needs a semicolon at the end:
$UserID = $_SESSION['SecurityAssistSiteSettingsID'];

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

I am still required to log back into admin after check out.

I have attached my log in page and checkout page in case its obvious.

Would you be good enough to have a look at my pages.

kind regards

Jonathon

Sign in to reply to this post

Jason ByrnesWebAssist

I dont see the login page attached?

Sign in to reply to this post

Jon CunninghamBeta Tester

Sorry here it is now

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

Jason ByrnesWebAssist

so the session being created at login is:
SecurityAssist_SiteSettingsID

so you need to store that session to an application variable:
$SecurityAssist_SiteSettingsID = $_SESSION['SecurityAssist_SiteSettingsID'];


then reset it after the session is destroyed:

$_SESSION['SecurityAssist_SiteSettingsID'] = $SecurityAssist_SiteSettingsID;

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