From 29656bd4d7a48a8e8c53197894e78931b7885642 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sun, 14 Jun 2026 19:50:29 +0000 Subject: [PATCH] Add product count column to product types admin page Shows how many active products are linked to each type, linked to the filtered products list. Co-Authored-By: Claude Sonnet 4.6 --- admin/product-types.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/admin/product-types.php b/admin/product-types.php index c3525b8..5145c13 100644 --- a/admin/product-types.php +++ b/admin/product-types.php @@ -38,7 +38,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } } -$types = db()->fetchAll("SELECT * FROM product_types ORDER BY name ASC"); +$types = db()->fetchAll( + "SELECT pt.*, COUNT(p.product_id) AS product_count + FROM product_types pt + LEFT JOIN products p ON p.product_type_id = pt.type_id AND p.is_active = 1 + GROUP BY pt.type_id + ORDER BY pt.name ASC" +); ?>