I have question about the SESSION array.
I just add item and qty in different session. I use code like this :
$_SESSION[\'idproduct\'] = $id.\",\";
The best way to achieve it is to store quantity as a value with product ID as a key, so if you have:
idproduct = 1,4,6,
qtyproduct = 3,4,5,
Store it as:
$_SESSION['qtyproduct'] = array(
1 => 3,
4 => 4,
6 => 5,
);
Right now if you have a product id:
$id = 4;
You can access quantity with:
$quantity = $_SESSION['qtyproduct'][$id];
and modify it with:
$_SESSION['qtyproduct'][$id] = 7;