magento

magento 1.9 get parent category of category & attribute set name

get the name of parent category

$abc = Mage::registry(‘current_category’)->getName();
$_category = Mage::getResourceModel(‘catalog/category_collection’)
->addFieldToFilter(‘name’, $abc)
->getFirstItem();
$categoryId = $_category->getId();
$categoryle = Mage::getModel(‘catalog/category’)->load($categoryId);
$catnames = array();
foreach ($categoryle->getParentCategories() as $parent) {
$catnames[] = $parent->getName();
}

Get attribute set name of the product by id

$productle = Mage::registry(‘current_product’);
$prodid = $productle->getId();
$attributeSetModel = Mage::getModel(“eav/entity_attribute_set”);
$sess_product = Mage::getModel(‘catalog/product’)->load($prodid);
$attributeSetModel->load($sess_product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();

Leave a Reply

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