
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 1.05 KB | hits: 19 | expires: Never
Error Adding to cart in Codeigniter shopping cart class
class Cart extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('cart_model', 'cart_model', TRUE);
$this->load->library('cart');
}
public function index() {
echo $this->cart->total_items();
}
public function add(){
$data = array(
'id' => 'ssksdu_123ABC',
'qty' => 3,
'price' => 39.95,
'name' => 'T-Shirt',
'options' => array('Size' => 'L', 'Color' => 'Red')
);
$add = $this->cart->insert($data);
if($add){
redirect('cart');
}
}
}
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;