且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在管理面板中获取产品ID

更新时间:2023-11-29 22:28:52

如果您查看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();