在magento中,我想添加像这样的快速外观功能http://www.timberlandonline.co.uk/on/demandware.store/Sites-TBLGB-Site/default/Link-Category?cgid=men_footwear_boots。我在list.phtml中添加了一个隐藏输入& div。如果我单击任何产品的div,则返回第一个产品ID产品在该类别页面中。但它应该返回所选div的产品ID。在magento中获取产品ID
9
A
回答
16
您需要仔细检查此页(<path_to_your_template_folder>/template/catalog/product/list.phtml
)。你会发现下面的代码行中只有这个页面的不同的地方: -
$_productCollection = $this->getLoadedProductCollection();
foreach ($_productCollection as $_product):
$reqProductId = $_product->getId();
endforeach;
如果你精心搭配上面的代码&在上述页面的代码,你会知道你需要使用变量“$reqProductId
”正常型“hidden
”你需要“INPUT
”元素。所以,你会需要它做你的一部分在主“foreach
”循环。
希望它有帮助。获得当前加载
2
试试下面的代码产品编号:
$product_id = $this->getProduct()->getId();
当你没有获得$this
,您可以使用Magento的注册表:
$product_id = Mage::registry('current_product')->getId();
也为产品类型我认为
$product = Mage::getModel(‘catalog/product’)->load($product_id);
$productType = $product->getTypeID();
相关问题
- 1. 使用大产品的产品ID获取产品sku在Magento
- 2. 在magento中获取产品ID和产品类型?
- 3. 在Magento的产品比较页上获取产品ID?
- 4. Magento - 按类别获取产品ID
- 5. Magento:从产品iD获取产品类别阵列
- 6. 在Magento中,如何从list.phtml中的产品ID获取产品类型?
- 7. 在magento中按名称搜索产品并获取产品ID数组
- 8. 在magento中获取产品重量
- 9. Magento:从产品ID和当前类别获取相关产品ID
- 10. Magento - 获取当前产品
- 11. Magento:获取产品ID在PHP块中可用list.phtml
- 12. 在Magento块中获取产品类别ID
- 13. magento在产品列表页面中获取子子类别ID
- 14. 如何在头部内部的magento中获取产品ID?
- 15. 如何从产品ID获得产品信息在Magento 2
- 16. Magento捆绑产品从产品ID
- 17. Magento:在分组产品中获取产品网址
- 18. 在magento中获取产品或产品编号
- 19. 在magento中保存产品前后获取产品数量
- 20. Magento - 获取给定产品ID的购物车商品
- 21. Python - 获取Flipkart产品ID
- 22. 如何使用Magento中的超级属性获取产品ID?
- 23. 获取magento中的所有网站产品ID
- 24. 如何使用SQL获取magento中的产品ID和sku
- 25. Magento从产品中获取特定类别ID
- 26. 通过magento中的产品id获取客户的SKU
- 27. 通过magento中的用户id获取产品
- 28. 在事件catalog_product_import_finish_before上获取产品实体ID magento 2
- 29. 获取magento中产品的总收入
- 30. Magento的 - 从产品ID
Thanks.I存储每个产品我d在锚标记的ID,并使用jquery获取id。我也会尝试这种方法。 – blakcaps 2011-04-15 05:11:25
任何想法如何在管理面板/目录/管理产品中获取产品ID? ... http://stackoverflow.com/questions/8499447/get-product-id-in-admin-panel – enloz 2011-12-14 04:25:02