And why it used twice, after else statement?
Code: Select all
$cart[] = array('product' => $product, 'quantity' => 1);Code: Select all
<?php
if (!$in_cart) {
$cart[] = array('product' => $product, 'quantity' => 1);
}
} else {
$cart[] = array('product' => $product, 'quantity' => 1);
}
$_SESSION['cart'] = $cart;
?>