View Full Version : help with cart function

06-14-2009, 01:05 PM
I have this shopping cart function which displays how many items I have in my basket on every page. The function does work but it is currently saying that I have just 1 item in my cart even though I have many more items in the cart, how do I make the code right so it displays the correct amount of items in my cart.

function writeShoppingCart() {
$cart = $_SESSION['cartGuid'];
if (!$cart) {
return '<p>You have no items in your shopping cart</p>';
} else {
// Parse the cart session variable
$items = explode(',',$cart);
$s = (count($items) > 1) ? 's':'';
return '<p>You have <a href="cart.php">'.count($items).' item'.$s.' in your shopping cart</a></p>';


06-20-2009, 08:32 PM
can anyone help me with this?