4

How can I check category have any child category with specific name ?

$category = Mage::getModel('catalog/category')->load($name, 'name');

but I want sub category from specific parent category.

3 Answers 3

6

you can try using category collection

$collection->addAttributeToSelect('*')
              ->addAttributeToFilter('parent_id',$parent_id)
              ->addAttributeToFilter('name', array(
              'like' => '%amit%'
             ));
3

You can try This Code.

$category_model = Mage::getModel('catalog/category');
$_category = $category_model->load(13);
$all_child_categories = $category_model->getResource()->getAllChildren($_category);
print_r($all_child_categories);
0

here 149 is Category id you can replace with your own

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

    $category->load(149); 
    $childrenString = $category->getChildren(); 
    $children = explode(',',$childrenString); 

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.