oop shopping cart/cms
Posted: Sat Apr 24, 2010 7:07 am
Hi I'm a php OOP beginner, but have worked with OOP languages before. I'm trying to build a CMS/Shopping cart and was wondering if the way I am going about it is correct.
Basically i'm thinking that i'll store the main class inside a session and just serialize/unserialize it when i need to do something. like:
That way everything is stored in the cart object and it's children and I only have the one session var.
Any thoughts would be appreciated!
Basically i'm thinking that i'll store the main class inside a session and just serialize/unserialize it when i need to do something. like:
Code: Select all
if (isset($_SESSION['cart'])) {
$cart = unserialize($_SESSION['cart']);
//do stuff
$_SESSION['cart'] = serialize($cart);
}
Any thoughts would be appreciated!