I'm trying to add items to the cart when i tried first time its worked but when i did the update function, the insert function not working, Can Anyone Help? thanks in advance
This is the code
public function addCart($id,$qty,$price,$name,$color,$cat)
{
$size=$this->input->post('size');
$data = array(
'id' => $id,
'qty' => $qty,
'price' => $price,
'name' => $name,
'options' => array('Size' => $size, 'Color' => $color)
);
$res=$this->cart->insert($data);
if($res == true){
$this->session->set_flashdata('success',urldecode($name).' Added in Cart.');
redirect('product/view_all/'.$cat);
}
else{
$this->session->set_flashdata('success','Product Adding Failed :(');
redirect('product/view_all/'.$cat);
}
}
public function viewCart()
{
$data['title']="Products in Cart | DreamShopie.in";
$this->load->view('templates/header',$data);
$this->load->view('templates/menu');
$this->load->view('main_page/cartView',$data);
$this->load->view('templates/footer');
}
public function removeCart($id)
{
$data = array(
'rowid' => $id,
'qty' => 0
);
$this->cart->update($data);
$this->session->set_flashdata('success', 'Item Removed');
redirect('cart/viewCart');
}