</header> <?php require_once '../includes/session-start.php'; require_once '../functions/cart-functions.php'; require_once '../functions/dbConn.php'; require_once '../functions/until.php'; require_once '../functions/categoryFunctions.php'; require_once '../functions/productsFunctions.php'; startCart(); $allCategories = getAllCategories(); $allProducts = getAllProducts(); $categorySelected = filter_input(INPUT_GET, 'cat'); if ($categorySelected != "") { $allProducts = getProductByCategory($categorySelected); } $action = filter_input(INPUT_POST, 'action'); if ($action === 'buy') { $productID = filter_input(INPUT_POST, 'product_id'); addToCart($productID); } if ($action === 'empty') { unset($_SESSION['cart']); header('Location: ?cart'); exit; } include_once '../includes/categories.php'; include_once '../includes/products.php'; ?> <br />
echo getBatikHeader(); ?> <div class="main-body"> <?php if (isset($_GET['id'])) { $category = getCategoryById($_GET['id']); if (!is_null($category)) { ?> <h2 class="main-title"><?php echo $category->categoryname; ?> </h2> <hr/> <?php $productlist = getProductByCategory($_GET['id']); echo print_product_list($productlist, "Daftar Barang", "product-category-list"); } else { echo printProductNotFound(); } } else { echo printProductNotFound(); } ?> </div> <?php echo getBatikFooter(); ?> </body> </html>