diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 134fc8cf7..5ee8e639e 100644 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -80,6 +80,8 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface Argument::createBooleanTypeArgument('current'), Argument::createBooleanTypeArgument('not_empty', 0), Argument::createBooleanTypeArgument('with_prev_next_info', false), + Argument::createBooleanTypeArgument('need_count_child', false), + Argument::createBooleanTypeArgument('need_product_count', false), Argument::createBooleanOrBothTypeArgument('visible', 1), new Argument( 'order', @@ -213,13 +215,20 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface ->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE')) ->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION')) ->set("META_KEYWORDS" , $category->getVirtualColumn('i18n_META_KEYWORDS')) - ->set("PRODUCT_COUNT" , $category->countAllProducts()) - ->set("CHILD_COUNT" , $category->countChild()) + ->set("VISIBLE" , $category->getVisible() ? "1" : "0") ->set("POSITION" , $category->getPosition()) ; + if ($this->getNeedCountChild()) { + $loopResultRow->set("CHILD_COUNT", $category->countChild()); + } + + if ($this->getNeedProductCount()) { + $loopResultRow->set("PRODUCT_COUNT", $category->countAllProducts()); + } + if ($this->getBackend_context() || $this->getWithPrevNextInfo()) { // Find previous and next category $previous = CategoryQuery::create() diff --git a/templates/frontOffice/default/includes/menu.html b/templates/frontOffice/default/includes/menu.html index a34e99a1e..b7cb3509e 100644 --- a/templates/frontOffice/default/includes/menu.html +++ b/templates/frontOffice/default/includes/menu.html @@ -18,10 +18,10 @@ {/if} {/if} - {loop name="cat-parent-$level" type="category" parent=$parent} + {loop name="cat-parent-$level" type="category" parent=$parent need_count_child=1} {if $CHILD_COUNT> 0} -
  • +
  • {menu parent=$ID level=$level+1}
  • {else}