diff --git a/admin/products.php b/admin/products.php index 640c732..de1c48c 100644 --- a/admin/products.php +++ b/admin/products.php @@ -20,13 +20,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stock = $_POST['stock']; $img = $_POST['image_url']; $is_hot = isset($_POST['is_hot']) ? 1 : 0; + $is_active = isset($_POST['is_active']) ? 1 : 0; if ($id) { - $stmt = $db->prepare("UPDATE products SET name=?, category_id=?, description=?, content=?, price_usdt=?, stock=?, image_url=?, is_hot=? WHERE id=?"); - $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $id]); + $stmt = $db->prepare("UPDATE products SET name=?, category_id=?, description=?, content=?, price_usdt=?, stock=?, image_url=?, is_hot=?, is_active=? WHERE id=?"); + $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $is_active, $id]); } else { - $stmt = $db->prepare("INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); - $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot]); + $stmt = $db->prepare("INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot, is_active) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $is_active]); } header("Location: products.php"); exit; @@ -105,11 +106,15 @@ if (isset($_GET['edit'])) { -
-
+
所有更改将实时反映在 PC 端和手机端前端页面上。
+所有更改将实时反映在 PC 端 and 手机端前端页面上。
diff --git a/category.php b/category.php index e9fc19e..8d6432e 100644 --- a/category.php +++ b/category.php @@ -12,7 +12,7 @@ if (!$cat) { } // Fetch products for this category -$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = ? ORDER BY p.id DESC"); +$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = ? AND p.is_active = 1 ORDER BY p.id DESC"); $stmt->execute([$id]); $cat_products = $stmt->fetchAll(); ?> diff --git a/includes/footer.php b/includes/footer.php index 490bace..d1fd9a0 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,6 +1,7 @@ @@ -38,7 +39,7 @@ $current_page = basename($_SERVER['PHP_SELF']); 官方客服:点击跳转- 售后邮箱:support@hao-soft.world + 售后邮箱: