【问题标题】:how to display recently viewed products list on product details page - magento如何在产品详细信息页面上显示最近查看的产品列表 - magento
【发布时间】:2013-10-16 15:02:32
【问题描述】:

我已经为 magento 使用了 mobileshoppe 主题,并尝试在产品详细信息页面上显示最近查看的产品列表,但有些无法正常工作...

在 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') ?>

我用默认主题尝试过同样的方法,但它也不起作用,谁能帮我解决这个问题?

谢谢...

【问题讨论】:

    标签: magento themes product


    【解决方案1】:

    在产品详细信息模板 (view.phtml) 上,您必须在要放置块的 xml 中更具体。请参阅下面的示例,使用主题布局目录 (app/design/frontend/your package/your theme/layout/local.xml) 中的 local.xml 插入块。这是我正在处理的网站的示例。具有讽刺意味的是,我们在始终显示它时遇到了问题,我现在正试图解决这个问题,但这在大多数情况下都有效!尝试在您的 catalog.xml 中更具体,它应该可以工作。 xml在local.xml中,回显在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>
    

    【讨论】:

      【解决方案2】:

      能否请您将xml参考内容替换为左侧。

      不是这个

        <reference name="content">
      

      在下面使用并检查

        <reference name="left">
      

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

      干杯!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多