From 186b5ae199d0e181fc2cb1fd46d1e3076df43796 Mon Sep 17 00:00:00 2001 From: smueller Date: Fri, 29 May 2026 10:52:56 +0200 Subject: [PATCH] Implement product visibility management: Added configuration for product visibility in navigation and footer, along with helper functions to determine visibility and generate HTML attributes. Updated footer, header, and index files to utilize these new functions, enhancing the user interface by conditionally displaying products based on their visibility settings. --- backend/config/products-config.php | 33 ++++++++++++++++++++++++++++++ backend/includes/footer.php | 8 ++++---- backend/includes/functions.php | 2 ++ backend/includes/header.php | 10 ++++----- public/index.php | 6 +++--- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/backend/config/products-config.php b/backend/config/products-config.php index 34e96f9..5528db9 100644 --- a/backend/config/products-config.php +++ b/backend/config/products-config.php @@ -443,10 +443,43 @@ $PRODUCTS['webhosting'] = [ ], ]; +// Sichtbarkeit in Navigation, Footer und auf der Startseite (Seiten bleiben per URL erreichbar) +$PRODUCT_VISIBILITY = [ + 'vpc' => false, + 'vps' => false, + 'mail-gateway' => false, + 'webhosting' => true, +]; + // ============================================================================ // HILFSFUNKTIONEN // ============================================================================ +/** + * Prüft, ob eine Produktkategorie in der Navigation angezeigt wird + */ +function isProductVisible(string $productId): bool { + global $PRODUCT_VISIBILITY; + return $PRODUCT_VISIBILITY[$productId] ?? true; +} + +/** + * HTML hidden-Attribut für ausgeblendete Produktkategorien + */ +function productHiddenAttr(string $productId): string { + return isProductVisible($productId) ? '' : ' hidden'; +} + +/** + * Aktive Navigationsseiten für sichtbare Produktkategorien + * + * @return string[] + */ +function getVisibleProductPageIds(): array { + global $PRODUCT_VISIBILITY; + return array_keys(array_filter($PRODUCT_VISIBILITY, static fn(bool $visible): bool => $visible)); +} + /** * Alle Produkte abrufen */ diff --git a/backend/includes/footer.php b/backend/includes/footer.php index 03118f4..6e85e76 100644 --- a/backend/includes/footer.php +++ b/backend/includes/footer.php @@ -15,10 +15,10 @@
-
+
>
@@ -74,7 +74,7 @@ includeHeader($page_title, $page_description, $current_page); Mehr erfahren
-
+
>
@@ -92,7 +92,7 @@ includeHeader($page_title, $page_description, $current_page); Mehr erfahren
-
+
>