Get category by id
Get categories by parent category id with filter
$categories = Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('parent_id', array('eq' => $parent_id))
->addAttributeToFilter('name', array('like' => '%' . $_POST['cat_name'] . '%'))
->addAttributeToSelect('*')
->addIsActiveFilter();
Magento category filter by custom attributes
$categories = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToFilter('attribute_code_here', 'value_here');
$categories->addAttributeToFilter('parent_id', 2);//if you want only children of a specific category
foreach ($categories as $cat){
$category = Mage::getModel('catalog/category')->load($cat->getId()) ;
$imageSrc = Mage::getModel('catalog/category')->load($category->getId())->getThumbnail();
$ThumbnailUrl = Mage::getBaseUrl('media').'catalog/category/'.$imageSrc;
}
AddAttributeToFilter Conditionals In Magento
http://fishpig.co.uk/magento/tutorials/addattributetofilter/
$_category = Mage::getModel('catalog/category')
->setStoreId(Mage::app()->getStore()->getId())
->load($categoryId);
$categoryName = $_category->getName();
Get categories by parent category id with filter
$categories = Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('parent_id', array('eq' => $parent_id))
->addAttributeToFilter('name', array('like' => '%' . $_POST['cat_name'] . '%'))
->addAttributeToSelect('*')
->addIsActiveFilter();
Magento category filter by custom attributes
$categories = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToFilter('attribute_code_here', 'value_here');
$categories->addAttributeToFilter('parent_id', 2);//if you want only children of a specific category
foreach ($categories as $cat){
$category = Mage::getModel('catalog/category')->load($cat->getId()) ;
$imageSrc = Mage::getModel('catalog/category')->load($category->getId())->getThumbnail();
$ThumbnailUrl = Mage::getBaseUrl('media').'catalog/category/'.$imageSrc;
}
AddAttributeToFilter Conditionals In Magento
http://fishpig.co.uk/magento/tutorials/addattributetofilter/