问题描述
我在这里发现了一些问题。
我在codeigniter中使用购物车功能。而且我希望我的商店不能在1个购物车中插入其他产品。
示例:我的产品是T恤,我希望客户仅将1件产品添加到购物车1尺寸。如果购买尺寸为M的产品A的客户并且想要尺寸为L的产品B的客户,则系统显示警告“产品必须为M而不是其他尺寸”。客户可以购买尺寸为M而不是其他尺寸的产品A和B。
这是我的控制器:
public function buy()
{
$id = $_POST['id'];
$price = $_POST['price'];
$name = $_POST['name'];
$category = $_POST['category'];
$stock = $_POST['product_stock'];
$img_path = $_POST['img_path'];
$content_product = $_POST['content_product'];
$size = $_POST['size'];
$data = array(
'id' => $id,'qty' => $stock,'price' => $price,'name' => $name,'category' => $category,'img_path' => $img_path,'content' => $content_product,'size' => $size
);
$this->cart->insert($data);
if($size !='size'){
echo "<script>('The Size Produt Must Be Same !')</script>";
}else{
redirect('shopping');
}
}
很抱歉,我的脚本没有用,因为我只是尝试在我知道的地方
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)