Forum Moderators: coopster
I wrote my own shopping cart for my site using a string as a session value and it works OK (I use item_id1,qty;item_id2,qty,etc. and then explode it to figure out what's in the cart).
I want to make a new one now, and I can't decide whether to use an object as the cart to make everything a lot easier and more organized.
The only thing that's holding me back is the speed. Is it slow to do the serialize() unserialize() stuff for sessions? Or is there a faster way to use objects with sessions.
If there's no problems with the speed, is there anything else bad about using an object as a shopping cart?
I can't just say $_SESSION['cart'] = $cart_class; though, right?
I have to do the serialize() / unserialize() nonsense?
That's the trouble. I read that it's very slow.
Although I don't think it would be too slow in my situation because I'm sure the class will be relatively small. (Most people don't have more than 4 items in their cart at one time, so the class wouldn't be storing much data)