I am trying to make my own simple shopping cart by way of $_SESSION vars. I really dont know how to use the serialize or unserialize functions, but am willing to learn.
Basically i need to store both item number AND price in the variable, and possibly puting those variables in an array. But i dont know how to have a variable hold two or more values.
Old Cheap Way: product id and quantity
$_SESSSION[PRODUCT_6100] = "8";
$_SESSSION[PRODUCT_4100] = "6";
$_SESSSION[PRODUCT_2100] = "9";
But i want it to say
$_SESSION[PRODUCTS_IN_CART] = "6100 x 8, 4100 x 6, 2100 x 9"; Or something like that
I have heard that putting all like-minded things like "products ordered" in the same array is better than multiple _Session variables because you can do functions on them like array_unique and array_merge and stuff like that, though i don't know how i will use them yet.
I do know that i want to be able to break them all out to change qty and delete individual ones in the shopping cart page, then send them to the payment gateway, but keep them together so that i can just add another product and quantity to the "products in cart" session variable.