close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Order does no store in table

Thread began 3/23/2012 5:24 am by pau376010 | Last modified 3/30/2012 12:31 pm by Jason Byrnes | 1599 views | 5 replies |

pau376010

Order does no store in table

I am testing Ecart5 locally and find that new order does not add to orders table but substitutes the last one.
I can prevent this by either reiniciating the browser or doing logout/login. In this case, stores correctly the new order in both orders and orderdetails tables.
If I use in in production, in the case a customer made 2 or more orders, just the last one would remain. How could I avoid the problem?
I have even tried to manually change PHPSESSID by means of script

<?php
session_regenerate_id();
?>

but it doesn't work and old orders still disappears.

Thnks for your help.
Pau Alvarez

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code to the checkout success page just after the closing </html> trag:

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

pau376010

Orders do not store

When using your code, it simply disconnects the user. I would require a system that gives a new "order_id" without need of having to login again.
For time being, I have made a system that disconnects and logins the visitor in an automatic way, so that visitor will not know it, except for the fact that he sees 2 transitory pages running in the screen. It is, however, not quite an elegant way.
Perhaps I missed that I had to customize the red letters to something different?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

the user login is maintained through session variables.

to maintain the users as being logged in, you will need to know the names of the sessions that are crteated at login type, save them to application variables, then reset them after the session is restarted.


for example, if the login script creates sessions name "UserID" and "UserName", you can modify the session destroy code to save them and reset them like this:

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

//Save login sessions
if(isset($_SESSION['UserID'])) $UserID $_SESSION['UserID'];
if(isset(
$_SESSION['UserName'])) $UserName $_SESSION['UserName'];

// 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(); 

//Rest login sessions:
if(isset($UserID)) $_SESSION['UserID'] = $UserID;
f(isset($UserID)) $_SESSION['UserName'] = $UserName;
?>
Sign in to reply to this post

pau376010

Orders do not store

Now it works. Thank you for your indications.
Anyway, just for you to know, please note that it didn't work until I added

@session_start();

after
@session_regenerate_id();

It was quite hard to discover, as I am not an expert, but the result was worth.
Regards

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working, I've not had to use the session start function after regenerating the ID before, but thanks for posting this, i will keep it in mind for the future.

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