MAGENTO – Check if are on a subcategory and, if so, retrieve the id of his parent category

<?php $currentCategory = Mage::registry(‘current_category’); $parentCategory = Mage::getModel(‘catalog/category’)->load($currentCategory->getParentId()); $parentCategoryName = $parentCategory->getId();
if($parentCategoryName == 4):?>

<p> Contenuto da associare alla sotto categoria  della categoria con id 4 </p>

 

<?php else: ?> <!– Tutte le altre pag –>
<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘slide_prodotti’)->toHtml(); ?> <!– Slide generica –>
<?php endif; ?>