在管理面板中获取产品ID [英] Get product ID in Admin Panel
本文介绍了在管理面板中获取产品ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在管理面板/目录/管理产品/标签中获取当前产品ID?
How to get current product ID in Admin Panel / Catalog / Manage Products / Tab ?
我有一个自定义产品标签,不知道如何获取当前产品ID.
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() ?>
推荐答案
如果您查看Mage_Adminhtml_Catalog_ProductController
,您将看到有问题的产品两次,因此这两种方法都可以使用:
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();
这篇关于在管理面板中获取产品ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文