0

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:

http://www.partypieces.co.uk/busy-bees-1.html

1 Answer 1

1
$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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.