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

时间:2013-10-09 10:02:41

标签: magento themes product

我已经将mobileshoppe主题用于magento并尝试在产品详情页面上显示最近查看过的产品列表,但有些显示它无法正常工作......

在catalog.xml

添加了以下代码
<catalog_product_view translate="label">
<reference name="content">
<block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
</reference>
</catalog_product_view>

及以下代码位于app \ design \ frontend \ default \ mobileshoppe \ template \ catalog \ product \ view.phtml

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

我已尝试使用默认主题并且它也无法正常工作,任何人都可以帮我解决这个问题吗?

...谢谢

2 个答案:

答案 0 :(得分:2)

在产品详细信息模板(view.phtml)上,您必须在要放置块的xml中更具体。请参阅下面的示例,使用主题布局目录中的local.xml(app / design / frontend / your package / your theme / layout / local.xml)来插入块。这是我正在研究的网站的一个例子。具有讽刺意味的是,我们一直在显示它的问题,我现在正试图弄清楚,但这大部分时间都在工作!尝试在catalog.xml中更具体,它应该可以工作。 xml在local.xml中,echo在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>

答案 1 :(得分:0)

可以请将xml参考内容替换为左侧。

而不是这个

  <reference name="content">

使用以下内容并检查

  <reference name="left">

因为它是侧边栏的一部分所以它应该与左/右列一起使用,因为你想在页面中显示。

干杯!

相关问题