Hello
I am trying to create a shopping cart. I am storing the cart details in an object with functions such as 'addtocart', etc.
The problem that I am stuck on at the moment is that I am trying to determine if this is the first time the cart has been created to determine if to create a new instance of the class or to use the current cart object to add new items to i.e $cart-addtocart(??)
Below is the code where I trying to determine of the
include_once('libs/cart.php');
$cart = unserialize($_SESSION['cartid']);
if(isset($cart)
{
echo "here";
$cart = unserialize($_SESSION['cartid']);
} else {
echo "herenow";
$cart = new Cart();
}
$cart->addToCart($jewelID,$image,$price,$name);
}
The problem at the moment is that it keeps meeting the first condition and thinks that the cart object 'cartid' has been set when i first run the program
This is very new to me, and have been looking around to see how to best to resolve this.
Any help would be fully appreciated
Thanks
Ian