[eluser]jbibbings[/eluser]
I am trying to figure out how CI saves its cart session data to the database. I am expecting to see some information called 'cart_contents' in the user_data field. I have set up the ci_sessions table as outlined in the Session docs, and have the sessions saving to the DB.
I am using CI Version 2.0, PHP 5.2, MySQL 5.1.37
I have set up a test controller like so:
Quote:<?php
class Test extends CI_Controller{
function index(){
$this->output->enable_profiler(TRUE);
$this->load->library('cart');
$product_id = '65-232324-21';
$price = '50.00';
$name = 'Hello Yeah OK';
$add_qty = 1;
$add_data = array(
'id' => $product_id,
'qty' => $add_qty,
'price' => $price,
'name' => $name,
'foo' => 'bar',
'game' => 'on',
'choco' => 'yum'
);
// add the item to the cart
$this->cart->insert($add_data);
$this->load->view('test');
}
}
I have set up a view just to display the cart data like so:
Quote:<h1>Yeah whatever</h1>
<?php foreach ($this->cart->contents() as $items): ?>
<ul>
<li><?php echo $items['name']; ?></li>
<li><?php echo $items['id']; ?></li>
<li><?php echo $items['qty']; ?></li>
<li><?php echo $items['price']; ?></li>
</ul>
<?php endforeach; ?>
The items I have saved to the cart, are correctly displaying in the view. However, I do not see them in the ci_sessions table.
A typical entry in the user_data field looks like this:
Code:
a:2:{s:15:"flash:old:token";s:32:"302c1c0076988d68bd5382f9a016e3d2";s:15:"flash:new:token";s:32:"15ba88063f8cd4567c3b34306c584cbf";}
There is no cart_contents information here so I am unsure - where is CI storing all of this data? Am I crazy?