无法在 CodeIgniter 购物车中多次添加相同的产品
Unable to add same product more than once in CodeIgniter cart
我正在使用 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]);
我正在使用 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]);