I have situation where i want to store my whole cart into cookie so that if accidently user closed browser, cart contains the same contents using that cookie.
Right now, i am using codeigniter cart class to contain all the products user added to cart.
//array for product details...
$insert_data = array(
'id' => $this->input->post('id'),
'name' => $this->input->post('name'),
'price' => $this->input->post('price'),
'image' => $this->input->post('image'),
'qty' => 1
);
//add previously defined data to cart....
$this->cart->insert($insert_data);
//assigning whole cart to cookie
$this->input->set_cookie('cart_cookie', $this->cart->contents(),36000);
But here, set_cookie method is giving error as it is expecting second parameter to be string...But i want whole cart to be stored..
Any solution with this problem? Or is there any better solution than cookie?