且构网

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

如何在产品详细信息页面上显示最近查看的产品列表-magento

更新时间:2022-01-18 03:19:33

在产品详细信息模板(view.phtml)上,您必须在要放置块的xml中更具体.请参阅下面的示例,在主题布局目录(app/design/frontend/您的程序包/您的theme/layout/local.xml)中使用local.xml插入该块.这是我正在研究的站点中的一个示例.具有讽刺意味的是,我们一直无法正常显示它,我现在正在尝试解决这个问题,但这在大多数情况下都是有效的!尝试在您的catalog.xml中更具体,它应该可以工作. xml在local.xml中,回显在catalog/product/view.phtml

On the the product detail template (view.phtml) you have to be more specific in the xml where you want to place the block. See the example below using local.xml in the theme layout directory (app/design/frontend/your package/your theme/layout/local.xml) to insert the block. Here's an example from a site I'm working on. Ironically we are having problems with it displaying consistently, which I'm trying to figure out right now, but this is working most of the time! Try getting more specific in your catalog.xml and it should work. The xml is in local.xml, the echo is in catalog/product/view.phtml

<?php echo $this->getChildHtml('recently_viewed') ?>

<catalog_product_view> 
<reference name="content"> 
    <reference name="product.info">
        <block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" as="recently_viewed" />
    </reference>
</reference>