Magento 电子商务 - 如何调用产品详细信息并将其显示到 CMS 页面中?
我希望能够以与产品页面中显示的方式相同的方式插入和显示产品,但插入到 CMS 页面(包含属性、价格、订单按钮等...)
我已经成功创建了一个通过插入产品页面源代码的复制部分来创建页面,但考虑到我计划完成相当多的页面,这是一个相当漫长且耗时的过程。
因此我希望能够将产品详细信息调用到 CMS 页面中。
我以为我可以使用 view.phtml 并将其插入所需的 CMS 页面,但我也不知道如何定义product_id...
提前感谢大家的评论
I would like to be able to insert and display a product the same way it is displayed in the product page, but into a CMS page (with attributes, prices, order button, etc...)
I've succeeded in creating a single page by inserting copied parts of the source code of a product page but this is quite a lenghty and time consuming process considering that I'm planning to have quite a few pages done.
Therefore I would like to be able to call the product details into a CMS page.
I thought I could use the view.phtml and insert it into the desired CMS page but I couldn't figure out how to define the product_id either...
Thank you all in advance for your comments
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,CMS 宏如下所示:
{{block type="catalog/product" template="catalog/product/line-item.phtml" sku_id="CI 101"}}
引用模板目录/产品/line-item.phtml:
请注意,这会引入一些您可能在系统上找不到的自定义属性和变量。最重要的是 CMS 宏
{{block type="catalog/product" template="catalog/product/line-item.phtml" sku_id="CI 101"}}
和这一行:
< code>loadByAttribute('sku',$this->getData('sku_id')); ?>
在 CMS 页面上根据需要多次使用宏。
Hmm, CMS Macro like this:
{{block type="catalog/product" template="catalog/product/line-item.phtml" sku_id="CI 101"}}
Referencing template catalog/product/line-item.phtml:
Be aware this is pulling in several custom attributes and variables you probably won't find on your system. The most important is the CMS Macro
{{block type="catalog/product" template="catalog/product/line-item.phtml" sku_id="CI 101"}}
and this line:
<?php $_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->getData('sku_id')); ?>
Use Macro as many times on the CMS page as you want.