0

I want to know how can I do this. I want to when i click main category, just show configurable product in page, and when i click sub-category, show simple product in page. Please help me in this, it will be really appreciated.

Thanks

Init
  • 165
  • 8

1 Answers1

1

You can check category level and then can display configurable product in it

 if($category->getLevel() == 2){
        $_productCollection1 = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('type_id','configurable'); 

       foreach ($_productCollection1 as $product1) {
          echo $product1->getName();  
        }
}

Hope this will help