son Posted December 28, 2009 Share Posted December 28, 2009 I have a shopping cart that relies on session data, all working fine so far. Now, on website there is also facility to log in. When a user is logged in a session for user id is created as:$_SESSION['user_id'] = $row['user_id'];and user has few more options availble to users that are not logged in. The issue now is that it seems to mess up the cart session data ($_SESSION['cart']). Queries to insert data from cart page fail when a user is logged in. Printing the session array it always shows:Array ( [] => 132 )when the cart is actually empty. The user id I use to log in is 1.Adding an item to cart it will show for example:Array ( [] => 132 [441] => Array ( [fn] => 3 [var] => 0 [age] => 1 [qty] => 1 [price] => 1992.00 ) Using session data for two different purposes: Is there something I missed to do?Son Link to comment Share on other sites More sharing options...
son Posted December 28, 2009 Author Share Posted December 28, 2009 I have a shopping cart that relies on session data, all working fine so far. Now, on website there is also facility to log in. When a user is logged in a session for user id is created as:$_SESSION['user_id'] = $row['user_id'];and user has few more options availble to users that are not logged in. The issue now is that it seems to mess up the cart session data ($_SESSION['cart']). Queries to insert data from cart page fail when a user is logged in. Printing the session array it always shows:Array ( [] => 132 )when the cart is actually empty. The user id I use to log in is 1.Adding an item to cart it will show for example:Array ( [] => 132 [441] => Array ( [fn] => 3 [var] => 0 [age] => 1 [qty] => 1 [price] => 1992.00 ) Using session data for two different purposes: Is there something I missed to do?SonJust ignore this post: Working on another issue I found that the problem came from the fact that I tried to move stored product data back into session (in another file that is only accessed when user is logged in). That is why it only happened when user was/is logged in. Will try to remedy now... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.