0
votes

I am trying to get only which category name that assigned a product and which category's have not any sub-category.

E.g :

Category
                -> Sub-category 1
                -> Sub-category 2
                -> Sub-category 3 
                                  -> Sub-sub-category 1
                                  -> sub-Sub-category 2
                                                        -> product 1
                                                        -> product 2

The above example , I want to get only sub-sub-category 2.

1
how did you get the category name for the specific product? Actually I am new to Magento, I am unable to understand the accept answer - Deepanshu Goyal

1 Answers

1
votes

you can try this

 $categories = Mage::getModel('catalog/category')
                    ->getCollection()
                    ->addAttributeToSelect('*')
                    ->addIsActiveFilter()
                   ->addAttributeToFilter('level',3)