<?php
$pageTitle = 'Edit Product';
require_once __DIR__ . '/../../app/includes/header.php'; require_once __DIR__ . '/../../app/includes/product_helpers.php'; require_admin();
$stmt = db()->prepare('SELECT * FROM products WHERE id = ?'); $stmt->execute([(int)($_GET['id'] ?? 0)]); $product = $stmt->fetch();
if (!$product) { flash('error', 'Product not found.'); redirect('/products/index.php'); }
$viewOnly = !can_manage_products() || isset($_GET['view']);
$action = APP_BASE . '/products/update.php?id=' . (int)$product['id'];
require __DIR__ . '/form.php';
require_once __DIR__ . '/../../app/includes/footer.php';
