We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14fe257 commit e1bfbbbCopy full SHA for e1bfbbb
cart.php
@@ -34,8 +34,13 @@
34
include INC . 'header.php';
35
include INC . 'nav.php';
36
37
-$cart = $_SESSION['cart'];
38
-$count = count($cart);
+// Check to see if the cart is in the session data else default to null.
+// We do this because the $cart and $count variables are used extensively
39
+// below and will output warnings if we don't.
40
+if (isset($_SESSION['cart'])) {
41
+ $cart = $_SESSION['cart'];
42
+ $count = count($cart);
43
+}
44
?>
45
46
inc/nav.php
@@ -6,7 +6,6 @@
6
$cart = $_SESSION['cart'];
7
$count = count($cart);
8
} else {
9
- $cart = '';
10
$count = 0;
11
}
12
0 commit comments