在magento中获取产品ID
在magento中,我想添加像这样的快速查看功能 http://www.timberlandonline.co.uk/on/demandware.store/Sites-TBLGB-Site/default/Link-Category?cgid=men_footwear_boots。我添加了一个隐藏的输入& list.phtml 中的 div。如果我单击任何产品的 div,javascript 将返回该类别页面中第一个产品的产品 id。但它应该返回所选 div 的产品 id。
In magento,i want to add quick look feature like this http://www.timberlandonline.co.uk/on/demandware.store/Sites-TBLGB-Site/default/Link-Category?cgid=men_footwear_boots.I have added a hidden input & a div in list.phtml.If i click the div of any product javascript returns product id of first product in that category page.But it should return product id of the selected div.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要仔细查看此页面(
/template/catalog/product/list.phtml
)。您只会在本页的不同位置找到以下几行代码: -如果您仔细匹配上面的代码&查看上述页面中的代码,您将知道您需要在所需的“
INPUT
”类型“”元素中正确使用变量“
”。因此,您将需要它在主“$reqProductId
” >隐藏foreach
”循环中完成您的部分。希望有帮助。
You need to look into this page (
<path_to_your_template_folder>/template/catalog/product/list.phtml
) carefully. You will find the following lines of code in different places of this page only:-If you carefully match the above code & the code in the above-mentioned page, you will know that you need to use the variable "
$reqProductId
" properly in your required "INPUT
" element of type "hidden
". So you will require it to do your part in the main "foreach
" loop.Hope it helps.
尝试下面的代码来获取当前加载的产品ID:
当您无权访问
$this
时,您可以使用Magento注册表:我认为也适用于产品类型
Try below code to get currently loaded product id:
When you don’t have access to
$this
, you can use Magento registry:Also for product type i think