I use an extension to show the newest products of a category:
This works great. On every page I only get the new products of that category.
$cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); // set current category id
$category = Mage::getModel('catalog/category')->load($cat_id);
$_productCollection = $category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*')->setPageSize($qty);
I have a lot of sub categories. On my topmost category page I also get the new products of my sub categories.
That is even better. I now want to alter my extension to show all new products of all sub categories on the pages of each sub categories.
I’m new to Magento development but I think I just need to get a different $cat_id. But how to get the topmost category ID?