How to get product id from the current product page

Share

I wanted to implement a way that products images in magento could be able to have link to open a popup when the image is clicked to show a larger image in a separate browser window
for that we would need the product id to send it with the link url and receive it by get method there
I dont want to intruct the way we would show the product instead I want to show you how to get the current product id to send it with the url let say
ur/file.php?id=884

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

or if you could not able to use $this instead of the above you can use

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

Comments are closed.