'COALESCE(sale_price, price) ASC', 'price_high' => 'COALESCE(sale_price, price) DESC', 'name' => 'name ASC', default => 'created_at DESC' }; // Get total count $totalProducts = db()->count('products', $whereClause, $params); $pagination = paginate($totalProducts, $page, 12); // Get products $products = db()->fetchAll( "SELECT * FROM products WHERE {$whereClause} ORDER BY {$orderBy} LIMIT :limit OFFSET :offset", array_merge($params, ['limit' => $pagination['per_page'], 'offset' => $pagination['offset']]) ); // Get categories for filter $categories = db()->fetchAll( "SELECT DISTINCT category FROM products WHERE category IS NOT NULL AND category != '' AND is_active = 1 ORDER BY category" ); require_once __DIR__ . '/includes/header.php'; ?> Our Coffee Collection Discover your perfect brew from our selection of premium coffees All = htmlspecialchars(ucfirst($cat['category'])) ?> >Newest >Price: Low to High >Price: High to Low >Name Showing = count($products) ?> of = $totalProducts ?> products = $category ? ' in ' . htmlspecialchars(ucfirst($category)) : '' ?> No products found Try adjusting your search or filters View All Products Sale Featured = htmlspecialchars($product['category']) ?> = htmlspecialchars($product['name']) ?> = formatCurrency($price) ?> = formatCurrency($product['price']) ?> Add to Cart 1): ?> = $i ?>
Discover your perfect brew from our selection of premium coffees
Showing = count($products) ?> of = $totalProducts ?> products = $category ? ' in ' . htmlspecialchars(ucfirst($category)) : '' ?>
Try adjusting your search or filters