Trying to get the product count of a category which also counts the products in its children. Currently, I have:
$categories = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('level', 2)
->addAttributeToSelect('is_active', 1);
foreach ($categories as $cat) {
echo count($cat->getProductCollection());
}
however this returns the product count of the parent category without counting its child category products. How do I include the child categories in the parent count?