Welcome Guest, Not a member yet? Register   Sign In
Normal CI Sessions and Cart Sessions
#1

[eluser]Unknown[/eluser]
I seem to have a small problem. In my code, i am using the Shopping Cart class included in the SVN for CI. It is working absolutely wonderful. However, i am also setting a userdata session variable in my code. That also works.

My issue is that when i try to pull the userdata data out of the session it always comes back empty. When i check my ci_sessions database (where i have all session data stored) i see the following two sessions.

a:1:{s:13:"cart_contents"...... //For the Cart

-and-

a:1:{s:9:"affiliate";s:6:"100001";} //For the userdata variable im trying to pull back.

So my real question is, Is CI trying to pull the variable from the cart session instead of the other session? Why are two sessions created anyway? Shouldnt the cart see the current session and append the current session??

Any help would be great.

Thanks!
#2

[eluser]Zorancho[/eluser]
Well, i think as first you should post some code and for the userdata out of the session, first if you put something like this:
$session_data = array('user_id' => 1);
$this->session->set_userdata($session_data);
Then you can pull it out like this:
$user_id = $this->session->userdata('user_id');

CI session puts the cart data into array with key called cart_contents and it is different from the one in the userdata.




Theme © iAndrew 2016 - Forum software by © MyBB