diff --git a/src/Controller/CategoryController.php b/src/Controller/CategoryController.php index 7f5669d..3e872cb 100644 --- a/src/Controller/CategoryController.php +++ b/src/Controller/CategoryController.php @@ -31,7 +31,7 @@ final class CategoryController extends BaseController $categoriesTree = $this->addToTree($product->categories, $categoriesTree); } - return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'category_' . $category, 'categoryTree' => $categoriesTree]); + return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'category_' . $category, 'category' => $category, 'categoryTree' => $categoriesTree]); } private function addToTree(array $categories, mixed $categoriesTree) diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php index 3208b73..22bc991 100644 --- a/src/Twig/AppExtension.php +++ b/src/Twig/AppExtension.php @@ -71,19 +71,20 @@ class AppExtension extends AbstractExtension return $items->first(fn($item) => str_starts_with($item->created_at, $date)); } - public function renderCategoryTree($categories, $level = 0): string + public function renderCategoryTree($categories, $current, $level = 0): string { $tree = ''; if ($level == 0) { - $tree .= '