I want to display the products in a separate sub-category for other sub-categories within the listing. Basis rather than display a common list of products they are organized the way it is in this example:
1 Answer
$layer = Mage::getSingleton(‘catalog/layer’);
$_category = $layer->getCurrentCategory();
$currentCategoryId= $_category->getId();
$children = Mage::getModel('catalog/category')->getCategories(currentCategoryId);
foreach ($children as $category) {
echo '<h1>'. $category->getName().'</h1>'
$collection = Mage::getModel('catalog/product')->getCollection()->addCategoryFilter($category);
foreach($collection as $product)
{
$_product = Mage::getModel('catalog/product')->load($productID);
/* Do What You Want With Products
}
}
Try The above this is just a test not been tested.