Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get product ID in Admin Panel

Tags:

magento

How to get current product ID in Admin Panel / Catalog / Manage Products / Tab ?

enter image description here

I have a custom product tab and no idea how to get current product ID.

In frontend I would do something like this:

<?php $_product = $this->getProduct(); ?>
<?php echo $_product->getId() ?>
like image 698
enloz Avatar asked Dec 27 '22 09:12

enloz


1 Answers

If you look at Mage_Adminhtml_Catalog_ProductController you will see the product in question twice, so either of these will work:

$product = Mage::registry('product');
echo $product->getId();

$product = Mage::registry('current_product');
echo $product->getId();
like image 130
clockworkgeek Avatar answered Jan 11 '23 22:01

clockworkgeek