Skip to main content
added 29 characters in body; edited tags
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

I am trying to display number of products in in each category.. and using this code to display all subcategory of category id:3 It is showing but it is counting not visible and disable product also,

<?php
    $cats = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>
<ul>
    <?php foreach($cats as $category): ?>
    <li>
         <a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?>(<?php echo $category->getProductCount(); ?>)</a>
    </li>
    <?php endforeach; ?>
</ul>

Is there any good solution so that i can get exact count thats are visible-catalog search and active.

thanks

I am trying to display number of products in in each category.. and using this code to display all subcategory of category id:3 It is showing but it is counting not visible and disable product also,

<?php
$cats = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>
<ul>
<?php foreach($cats as $category): ?>
<li>
<a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?>(<?php echo $category->getProductCount(); ?>)</a>
</li>
<?php endforeach; ?>
</ul>

Is there any good solution so that i can get exact count thats are visible-catalog search and active.

thanks

I am trying to display number of products in in each category.. and using this code to display all subcategory of category id:3 It is showing but it is counting not visible and disable product also,

<?php
    $cats = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>
<ul>
    <?php foreach($cats as $category): ?>
    <li>
         <a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?>(<?php echo $category->getProductCount(); ?>)</a>
    </li>
    <?php endforeach; ?>
</ul>

Is there any good solution so that i can get exact count thats are visible-catalog search and active.

thanks

Tweeted twitter.com/#!/StackMagento/status/340468759393337345
Source Link

Category active product count on category list

I am trying to display number of products in in each category.. and using this code to display all subcategory of category id:3 It is showing but it is counting not visible and disable product also,

<?php
$cats = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>
<ul>
<?php foreach($cats as $category): ?>
<li>
<a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?>(<?php echo $category->getProductCount(); ?>)</a>
</li>
<?php endforeach; ?>
</ul>

Is there any good solution so that i can get exact count thats are visible-catalog search and active.

thanks