]> _ Git - pmi.git/commitdiff
done #2897 @0:05
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Jul 2019 16:58:10 +0000 (18:58 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Jul 2019 16:58:10 +0000 (18:58 +0200)
app/Templates/Catalog.php

index 767f2ea6078c8e108651166a081ab8a8196b9c45..bfe47763aa78df4615d174fe44646e50770359a5 100644 (file)
@@ -51,8 +51,8 @@ class Catalog extends TemplateAbstract
                 $category->setHref($productType->slug);
                 $category->setId('product_type_' . $productType->id);
                 $category->setController(['controller' => 'ProductController', 'action' => 'productList', 'params' => ['id' => $productType->id]]);
-                $item->addChild($category);
 
+                $count = 0;
                 foreach ($products as $product) {
                     if ($product->product_type != $productType->id) {
                         continue;
@@ -66,6 +66,11 @@ class Catalog extends TemplateAbstract
                     $detail->setId('product/' . $product->id);
                     $detail->setController(['controller' => 'ProductController', 'action' => 'productDetails', 'params' => ['id' => $product->id]]);
                     $category->addChild($detail);
+                    $count++;
+                }
+
+                if ($count) {
+                    $item->addChild($category);
                 }
             }
         }