5/15/2012

How to get current product id

Try below code to get currently loaded product id:

$product_id = $this->getProduct()->getId();

When you don’t have access to $this, you can use Magento registry:

$product_id = Mage::registry('current_product')->getId();

Enjoy.. :)

No comments:

Post a Comment