// include("includes/db.php"); // include("includes/functions.php"); if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0) { $sl=count($_SESSION['cart']); if($sl<=1){unset($_SESSION['cart']);} else{remove_product($_REQUEST['pid']);} } else if($_REQUEST['command']=='clear'){ unset($_SESSION['cart']); } else if($_REQUEST['command']=='update'){ $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=intval($_REQUEST['product'.$pid]); if($q>0 && $q<=1000){ $_SESSION['cart'][$i]['qty']=$q; } else{ $msg="Số lượng sản phẩm trong giỏ hàng phải ở trong khoảng từ 1 đến 1000"; } } } ?>