🔍 ENHANCED TEMPLATE DEBUG-MODUS"; echo "
";} // Sicherstellen, dass DEALFOXX definiert ist if (!defined('DEALFOXX')) { define('DEALFOXX', true); } // Hilfsfunktion für URLs - Links zu category_view.php für Produkte function createCategoryUrl($path) { return '/kategorie/' . ltrim($path, '/'); } // Sichere URL-Generierung für Kategorien function buildCategoryPath($currentPath, $slug) { if (empty($currentPath)) { return $slug; } return $currentPath . '/' . $slug; } // VEREINFACHTE DEBUG-AUSGABEif (isset($_GET['debug']) && $_GET['debug'] === '1') { echo "
"; echo "

🔍 KATEGORIE DEBUG

"; echo "leaf_category gesetzt: " . (isset($leaf_category) ? 'JA' : 'NEIN') . "
"; if (isset($leaf_category)) { echo "leaf_category ID: " . ($leaf_category['id'] ?? 'KEINE ID') . "
"; echo "leaf_category Name: " . ($leaf_category['name'] ?? 'KEIN NAME') . "
"; } echo "subcategories gesetzt: " . (isset($subcategories) ? 'JA (' . count($subcategories) . ' Einträge)' : 'NEIN') . "
"; echo "
";}// Verwende die bereits von kategorie.php geladenen Unterkategorien$enhanced_subcategories = [];if (!empty($subcategories)) { // Lade die Unterkategorien mit zusätzlichen Daten an foreach ($subcategories as $subcategory) { $enhanced_subcategory = $subcategory; // Produktanzahl für diese Kategorie ermitteln if (isset($pdo)) { try { $productStmt = $pdo->prepare("SELECT COUNT(*) FROM amazon_products WHERE category_id = :category_id"); $productStmt->bindValue(':category_id', $subcategory['id'], PDO::PARAM_INT); $productStmt->execute(); $enhanced_subcategory['product_count'] = $productStmt->fetchColumn(); // Prüfe auf Sub-Unterkategorien $childStmt = $pdo->prepare("SELECT id, name, slug FROM categories WHERE parent_id = :parent_id ORDER BY name"); $childStmt->bindValue(':parent_id', $subcategory['id'], PDO::PARAM_INT); $childStmt->execute(); $children = $childStmt->fetchAll(PDO::FETCH_ASSOC); // Für jedes Kind auch Produktanzahl ermitteln foreach ($children as &$child) { $childProductStmt = $pdo->prepare("SELECT COUNT(*) FROM amazon_products WHERE category_id = :category_id"); $childProductStmt->bindValue(':category_id', $child['id'], PDO::PARAM_INT); $childProductStmt->execute(); $child['product_count'] = $childProductStmt->fetchColumn(); } $enhanced_subcategory['children'] = $children; } catch (Exception $e) { $enhanced_subcategory['product_count'] = 0; $enhanced_subcategory['children'] = []; } } else { $enhanced_subcategory['product_count'] = 0; $enhanced_subcategory['children'] = []; } $enhanced_subcategories[] = $enhanced_subcategory; }}// Debug-Ausgabe für finale Ergebnisseif (isset($_GET['debug']) && $_GET['debug'] === '1') { echo "
"; echo "

✅ FINALE ERGEBNISSE

"; echo "enhanced_subcategories Anzahl: " . count($enhanced_subcategories) . "
"; if (!empty($enhanced_subcategories)) { echo "Kategorien:
"; foreach ($enhanced_subcategories as $index => $cat) { echo "[$index] " . ($cat['name'] ?? 'KEIN NAME') . " (ID: " . ($cat['id'] ?? 'KEINE ID') . ", Produkte: " . ($cat['product_count'] ?? 0) . ", Kinder: " . count($cat['children'] ?? []) . ")
"; } } else { echo "❌ KEINE KATEGORIEN GEFUNDEN!
"; } echo "
";}?>

LG OLED55G48LW TV 55" (139 cm) OLED evo Fernseher

Keine Unterkategorien verfügbar

In dieser Kategorie sind derzeit keine weiteren Unterkategorien verfügbar.

Nach oben