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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Cleaning all sessions after checkout

Thread began 6/12/2009 1:43 pm by info275691 | Last modified 10/23/2009 11:45 am by Ray Borduin | 4637 views | 30 replies |

info275691Beta Tester

Cleaning the Cart session after checkout

Hi,

We are tryin' to built first e-commerce website with eCart. (www.magicstore.magicbytes.nl).

Everything goes fine until the checkout page. If the customer wants to submit a second order in the same browser session than the order info being updated with the last one while the session ID stays same. How can we manage that the cart session has been reset after each order submit?

Regards.

Magic Bytes Team.

Sign in to reply to this post

Ray BorduinWebAssist

Clear the session variable used as the orderID on the Success page. The orderID session variable is set in the Store Cart Summary in Database server behavior on the confirm page.

You could also just clear the entire session, but that would also log the user out.

Sign in to reply to this post

info275691Beta Tester

Ray,

We are using the default [Session ID] of the eCart as Order_ID.
How can we reset/refresh the default session? Or do you have another solution how to store the Order_ID in database?

Sign in to reply to this post

Ray BorduinWebAssist

Use the sample code from:

function.session-destroy.php

that will clear the session.

Sign in to reply to this post

info275691Beta Tester

Ray,

We couldn't figure it out yet. I know it sounds silly but we are all designers, not programmers...

Maybe the attached screenshot explaines little bit more what our problem is.

What is the name of [Session ID] ?

Regards,

Magic Bytes Team

Sign in to reply to this post

Ray BorduinWebAssist

add this code to the bottom of your success page:

<?php
session_start();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
?>

the session id is the value of session_id:
function.session-id.php

if you want to regenerate that value it appears you can use:
session_regenerate_id
function.session-regenerate-id.php

Sign in to reply to this post

info275691Beta Tester

Ray,

The destroying of the session is okay now(also logs the user out but it's not that big deal) but regenerate is not working.Session ID stays the same.

Sign in to reply to this post

Ray BorduinWebAssist

Where did you add session_regenerate_id?

Sign in to reply to this post

info275691Beta Tester

Ray,

We put the following code at the end of success page.:

<?php
session_start();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
?>

<?php
session_start();

session_regenerate_id (true)
?>

Sign in to reply to this post

Ray BorduinWebAssist

Hmmm... maybe try:


<?php
session_start();

session_regenerate_id (true)
session_commit();
?>

It seems like it should work. Maybe us somethign besides the session_id as your orderID... there should also be an autonumber field in the orders database that is stored in the session and unique that shouldn't have this problem.

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