So I'm not sure whether there are similar questions elsewhere and this is my problem when change or add another qty on same item.
Add item with some qty to cart
After inserting item to cart then it will show in my cart list
After that, i add same item but now with different another quantity number (and the problem start...)
The problem now show here in my cart list. The quatity in my stock is only 5. When i add in first time it's look fine, but when i try to input with another quatity (in this case is 6) it will add to my cart and now my quatity buy is 11. This is over from my stock.
This is my controller to add item to cart
function addToCart()
{
$data = array(
'id' => @$this->input->post('registerNum'),
'qty' => @$this->input->post('buyQty'),
'price' => @$this->input->post('priceEach'),
'name' => @$this->input->post('itemName'),
);
$this->cart->insert($data);
redirect('admin/transaction/add');
}
So, anyone can help me with this problem?