I have the following PHP
if($this->input->post('stock_unity_push')=='0'){
$stock_unity_push = 0;
} else {
$stock_unity_push = str_replace(".", "", str_replace("R$ ", "", $this->input->post('stock_unity_push')));
$stock_unity_push = number_format((float)$stock_unity_push, 2, '.', '');
}
$data = array(
'id' => $this->input->post('product_id'),
'qty' => $this->input->post('stock_purchase'),
'price' => ($stock_unity_push) ? $stock_unity_push : '0',
'name' => 'product_'.$this->input->post('product_id')
//'options' => array('supplier' => $this->input->post('supplier'))
);
$this->cart->insert($data);
But to add to the cart, it adds only one record, and replaces the current cart. I'm using the codeigniter cart.