Magento Install

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.. :)
Posted by Unknown at 8:08 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)
Magento One Step Checkout Magento Extensions Free Virtuemart Extensions One Page Checkout For Virtuemart Magento Extensions Magento Themes Virtuemart templates Joomla Extensions Virtuemart Module

Blog Archive

  • ►  2013 (2)
    • ►  June (1)
    • ►  February (1)
  • ▼  2012 (43)
    • ►  December (3)
    • ►  October (3)
    • ►  August (4)
    • ►  July (15)
    • ►  June (4)
    • ▼  May (6)
      • Magento: Can not login to Magento Admin after inst...
      • Magento: 404 Error on Product Page
      • Magento: Add to compare not working without login
      • How to get current product id
      • Magento: Hide Tax from Grand Total in Customer Sho...
      • Magento: Sort products by Created At filter
    • ►  April (5)
    • ►  March (3)
Simple theme. Powered by Blogger.