我正在使用 codigniter 2.1.4 开发购物车。我的问题是我无法在购物车中多次添加相同的产品。但我可以更新购物车中的数量。 所以我的要求是,当第二次购物时,数量应该增加到2。
最佳答案
在您的 Cart.php 中替换以下代码
unset($this->_cart_contents[$rowid]);
有了这个
if(isset($this->_cart_contents[$rowid]))
{
$this->_cart_contents[$rowid]['qty']++;
return $rowid;
}
unset($this->_cart_contents[$rowid]);
关于codeigniter - 无法在 CodeIgniter 购物车中多次添加相同产品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44045222/