I have a sidebar block in my layout that is being displayed on different pages.
In this block I have a list of products, and I want to select the current product when I
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();