Reputation: 115
I am developing a shopping cart using codigniter 2.1.4. My issue is that I am unable to add same product more than one time in cart. But I can update the quantity in cart. So my requirement is that when cart the item for second time quantity should be increment to 2.
Upvotes: 2
Views: 438
Reputation: 1521
In your Cart.php replace the following code
unset($this->_cart_contents[$rowid]);
with this
if(isset($this->_cart_contents[$rowid]))
{
$this->_cart_contents[$rowid]['qty']++;
return $rowid;
}
unset($this->_cart_contents[$rowid]);
Upvotes: 2