magento search category name

Magento how to get category collection by name ?

For example here we will get category by it name

$category = Mage::getModel("catalog/category");

$collection = $category->getCollection();

$collection->addAttributeToSelect("*");

$collection->addFieldToFilter("name",array("eq"=>'test');

The above code will fetch all category named “test”.

Leave a Reply

Your email address will not be published. Required fields are marked *