load child count and product count on category loop id needed
This commit is contained in:
@@ -80,6 +80,8 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
|
|||||||
Argument::createBooleanTypeArgument('current'),
|
Argument::createBooleanTypeArgument('current'),
|
||||||
Argument::createBooleanTypeArgument('not_empty', 0),
|
Argument::createBooleanTypeArgument('not_empty', 0),
|
||||||
Argument::createBooleanTypeArgument('with_prev_next_info', false),
|
Argument::createBooleanTypeArgument('with_prev_next_info', false),
|
||||||
|
Argument::createBooleanTypeArgument('need_count_child', false),
|
||||||
|
Argument::createBooleanTypeArgument('need_product_count', false),
|
||||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
@@ -213,13 +215,20 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
|
|||||||
->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE'))
|
->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE'))
|
||||||
->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION'))
|
->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||||
->set("META_KEYWORDS" , $category->getVirtualColumn('i18n_META_KEYWORDS'))
|
->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("VISIBLE" , $category->getVisible() ? "1" : "0")
|
||||||
->set("POSITION" , $category->getPosition())
|
->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()) {
|
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
|
||||||
// Find previous and next category
|
// Find previous and next category
|
||||||
$previous = CategoryQuery::create()
|
$previous = CategoryQuery::create()
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/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}
|
{if $CHILD_COUNT> 0}
|
||||||
<li><a href="{$URL}#collapse{$ID}" class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#collapse{$ID}">{$TITLE} ({$PRODUCT_COUNT})</a>
|
<li><a href="{$URL}#collapse{$ID}" class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#collapse{$ID}">{$TITLE}</a>
|
||||||
{menu parent=$ID level=$level+1}
|
{menu parent=$ID level=$level+1}
|
||||||
</li>
|
</li>
|
||||||
{else}
|
{else}
|
||||||
|
|||||||
Reference in New Issue
Block a user