<?php require_once __DIR__ . '/includes/bootstrap.php'; define('PRESTIGE_FRONTEND', true); $slug = slugify($_GET['slug'] ?? ''); $product = db()->fetchOne( "SELECT p.*, c.name AS category_name, c.slug AS category_slug FROM products p LEFT JOIN product_categories c ON p.category_id = c.id WHERE p.slug = ? AND p.status = 'published'", [$slug] ); if (!$product) { http_response_code(404); $meta_title = 'Product Not Found - ' . setting('site_name'); $meta_description = ''; include __DIR__ . '/includes/theme_header.php'; ?> <section class="page-hero"> <div class="container page-hero-content"> <div class="page-hero-eyebrow"> Products</div> <h1 class="page-hero-title">Product not<br><em>found.</em></h1> <p class="page-hero-sub">The product you are looking for is no longer available.</p> </div> </section> <?php include __DIR__ . '/includes/theme_footer.php'; ?> <?php exit; } $meta_title = ($product['meta_title'] ?? '') ?: ($product['name'] . ' - ' . setting('site_name')); $meta_description = ($product['meta_description'] ?? '') ?: ($product['short_description'] ?: 'Premium aluminium product by ' . setting('site_name') . '.'); $og_image = ($product['og_image'] ?? '') ?: ($product['featured_image'] ? (strpos($product['featured_image'], '/') !== false ? $product['featured_image'] : 'products/' . $product['featured_image']) : setting('og_image')); $image = $product['featured_image'] ? product_image_url($product['featured_image']) : 'https://images.unsplash.com/photo-1600566753190-17f0baa2a6c3?w=1600&q=85'; $related = db()->fetchAll( "SELECT slug, name, short_description, featured_image FROM products WHERE status = 'published' AND id != ? AND (category_id <=> ?) ORDER BY sort_order, created_at DESC LIMIT 3", [$product['id'], $product['category_id']] ); include __DIR__ . '/includes/theme_header.php'; ?> <section class="page-hero"> <div class="container page-hero-content"> <div class="page-hero-eyebrow"> <?= e($product['category_name'] ?: 'Product') ?></div> <h1 class="page-hero-title"><?= e($product['name']) ?></h1> <?php if ($product['short_description']): ?> <p class="page-hero-sub"><?= e($product['short_description']) ?></p> <?php endif; ?> </div> </section> <section class="page-content"> <div class="container"> <div class="page-content-inner"> <img src="<?= e($image) ?>" alt="<?= e($product['name']) ?>" loading="lazy"> <?php if ($product['description']): ?> <?= safe_html($product['description']) ?> <?php elseif ($product['short_description']): ?> <p><?= e($product['short_description']) ?></p> <?php endif; ?> <p> <a href="<?= url('request-quote?product=' . e($product['slug'])) ?>" class="btn btn-dark"> Request a quote <span class="btn-arrow">’!</span> </a> </p> </div> </div> </section> <?php if (!empty($related)): ?> <section class="section products-list" style="background:var(--bone);"> <div class="container"> <div class="section-header reveal"> <div class="section-meta"> <span class="section-index"> More</span> <span class="section-label-text">Related Products</span> </div> <h2 class="section-title">Explore similar<br><em>systems.</em></h2> </div> <div class="products-grid reveal"> <?php foreach ($related as $i => $p): $img = $p['featured_image'] ? product_image_url($p['featured_image']) : 'https://images.unsplash.com/photo-1600566753190-17f0baa2a6c3?w=1600&q=85'; ?> <a href="<?= url('products/' . e($p['slug'])) ?>" class="product-card"> <img class="product-img" src="<?= e($img) ?>" alt="<?= e($p['name']) ?>" loading="lazy"> <div class="product-overlay"></div> <div class="product-meta-top"><?= str_pad($i + 1, 2, '0', STR_PAD_LEFT) ?></div> <div class="product-info"> <div> <div class="product-name"><?= e($p['name']) ?></div> <?php if ($p['short_description']): ?><div class="product-desc"><?= e($p['short_description']) ?></div><?php endif; ?> </div> <div class="product-arrow">’!</div> </div> </a> <?php endforeach; ?> </div> </div> </section> <?php endif; ?> <section class="final-cta"> <div class="final-cta-inner reveal"> <div class="final-eyebrow"> Custom Project</div> <h2 class="final-title">Need dimensions<br><em>or pricing?</em></h2> <div class="final-row"> <p class="final-description">Tell us about your opening, finish, location, and timeline. We will prepare a tailored quote.</p> <div class="final-actions"> <a href="<?= url('request-quote?product=' . e($product['slug'])) ?>" class="btn btn-final-primary">Request a Quote <span class="btn-arrow">’!</span></a> </div> </div> </div> </section> <?php include __DIR__ . '/includes/theme_footer.php'; ?>