how to display quantity of items in shopping cart
Posted: Sun Apr 24, 2011 10:08 am
hi,i face some problem to display quantity of item in shopping cart..this is my error Warning: explode() expects parameter 2 to be string, array given in
can anyone help me??thanks in advance..
Code: Select all
function writeShoppingCart() {
$cartid = $_SESSION['cartid'];
if (!$cartid) {
return '<p>You have no items in your shopping cart.</p>';
} else {
// Parse the cart session variable
$items = explode(',',$cartid);
$s = (count($items) > 1) ? 's':'';
return '<p>You have <a href="viewCart.php">'.count($items).' item'.$s.' in your shopping cart.</a></p>';
}
}