How to get current category name and id on product page in magento.?

Following is the code to get current Category name and id on product page in Magento.


  $catname = Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); //gives current  category name
  $catid = Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); //gives current category id
Location of the product page template varies from theme to theme.

You may also like...

Leave a Reply

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