views:

12

answers:

1

hi,

i want to use this site as a reference to explain what im trying to figure out. http://www.shop-script.com/demo/store/index.php?lang=eng

if you select a product then enter a value higher than 1 for the quantity of a product that you want then press add to cart. i know that this information goes into a session but how is it added?

what i do know is say a session named cart is created or exists and the products id is inserted into the session to look like something like this:

$_SESSION['cart'] = "100" //product id

how can i insert the amount of quantities that were entered on the products detail page? that is one thing that is confusing me. thanks

A: 

Just use the product ID as a key in a session variable holding the quantity:

$item_id = 1000;

$_SESSION['item_id'] = $item_id;
$_SESSION[$item_id]['quantity'] = 10; // Set quantity to 10
John Conde