moved website outside of panel folder
This commit is contained in:
parent
92ac778956
commit
08f07dca97
10328 changed files with 90 additions and 501 deletions
22
Website/includes/cart_helper.php
Normal file
22
Website/includes/cart_helper.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
// Helper to read cart items stored in session and return count
|
||||
// Non-invasive: reads $_SESSION['cart'] if present and returns total quantity or items count
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
@session_start();
|
||||
}
|
||||
|
||||
function get_cart_count() {
|
||||
if (!isset($_SESSION['cart']) || !is_array($_SESSION['cart'])) {
|
||||
return 0;
|
||||
}
|
||||
$count = 0;
|
||||
foreach ((array)$_SESSION['cart'] as $item) {
|
||||
if (is_array($item) && isset($item['quantity'])) {
|
||||
$count += (int) $item['quantity'];
|
||||
} else {
|
||||
$count += 1;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue