close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Orders not holding in database

Thread began 2/02/2010 7:20 am by jenbar3378469 | Last modified 6/15/2010 1:38 pm by Jason Byrnes | 5886 views | 20 replies |

jenbar3378469

Orders not holding in database

Hi, when someone with the same email address places 2 different orders, the first order disappears from the database. I have had my store up and running for a while using ecart and universal email. I recently purchased the rest of your extensions. Does Webassist have an extension that would help with this problem? Also, after someone places an order, the cart does not clear. It still holds the order in the cart. Can you please help me with these issues?

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

I believe the issues are linked to the same cause.


On the checkout success, add the following code juyst after the closing </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

jenbar3378469

Hi, thanks for the code below. I copy and pasted to after the ending html tag, however it is not working. When I go to submit a second order it is giving me this error:

Duplicate entry 'mcs6706e3jpj3n2rbqkfvqebr3' for key 'OrderReferenceId'

Also, I think that it is logging the person out all together instead of just clearing the cart.
Please help!

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

if you want to keep the user logged in, you will need to add additional code to store the users session variable into an application variable, the reset it once the session is destroyed. for example, if the User Session variable is name "UserID", the code would look like:

php:
<?php


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


//store the user session
$userSession $_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();
unset(
$_SESSION);
session_regenerate_id();

//reset user session
$_SESSION['UserID'] =$userSession;
?>




The above code also contains some extra code that should fix the error you are getting. You will need to change $_SESSION['UserID'] to reflect the name of the session variable you wish to keep.

Sign in to reply to this post

jenbar3378469

Not to sound like a complete moron, but how do I determine what my session name is? I looked at the confirm page and it says: $WA_sessionName = "sumidrive1_OrderID"; Would that be how I set my session name on this checkout_success.php page too?

Also when your code says: // If you are using session_name("something"), don't forget it now!
session_start();

does this mean that I need to put the name of my session in the parentheses session_start(); ???

If so, then in your last code, could you please tell me exactly where I need to insert my session name?

Thanks!!!!!

Sign in to reply to this post

Jason ByrnesWebAssist

your login page will store the logged in users ID in a session variable. If you are using security assist, double click the authenticate user server behavior. Go to the third page of the wizard, the names of the session variables that re created on log in will be listed here.



No, you do not need to enter the name o the session, the only code that needs to be modified at all is:
$userSession = $_SESSION['UserID'];

and:
$_SESSION['UserID'] =$userSession;


this code just needs to substitute UserID with the name of your user session.

Sign in to reply to this post

jenbar3378469

Hi, I set these pages up before I purchased Security Assist so I used Dreamweaver's Server Behaviors and I noticed that the code reads like this:

$_SESSION['MM_Username'] = NULL;

So is MM_Username the name of the session?

Thanks again for all of your help!!

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, it looks like MM_Username is the name of the session for the logged in user.

Sign in to reply to this post

Alexneg66

I had the same problem. Because I have four session variables, I writed so (I also writed the line number):

php:
277 <?php

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

        
//store the user session
        
$userSession $_SESSION['var_CL_ID'];
        
$nomeSession $_SESSION['var_CL_Nominativo'];
        
$mailSession $_SESSION['var_CL_Un_Email'];
        
$privSession $_SESSION['var_CL_Priv'];

        
// Unset all of the session variables.
290  $_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"]
           );
300   }

        
// Finally, destroy the session.
        
session_destroy();
        unset(
$_SESSION);
        
session_regenerate_id();

        
//reset user session
          
$_SESSION['var_CL_ID'] = $userSession;
          
$_SESSION['var_CL_Nominativo'] = $nomeSession;
          
$_SESSION['var_CL_Un_Email'] = $mailSession;
          
$_SESSION['var_CL_Priv'] = $privSession;
312 ?>


but I get this error:
Warning: Cannot modify header information - headers already sent by (output started at D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php:194) in D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php on line 300

Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php on line 306
PHP Warning: Cannot modify header information - headers already sent by (output started at D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php:194) in D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php on line 300 PHP Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in D:\atpz.it\atpz.it\atpz_area_Cliente_checkout_success.php on line 306

Sign in to reply to this post

Jason ByrnesWebAssist

try making the following changes

1)
session_start();

to:
@session_start();


2)
session_destroy();
unset($_SESSION);
session_regenerate_id();

to:
@session_destroy();
@unset($_SESSION);
@session_regenerate_id();

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