Try below code to get currently loaded product id:
$category_id = Mage::getSingleton('catalog/layer')
->getCurrentCategory()
->getId();
->getCurrentCategory()
->getId();
When you don’t have access to $this, you can use Magento registry:
$category_id = Mage::registry('current_category')->getId();
Enjoy.. :)
No comments:
Post a Comment