how to display recently viewed products list on product details page - magento

余生颓废 提交于 2020-01-24 12:49:09

问题


I have used mobileshoppe theme for magento and trying to display recently viewed product list at product details page but some how its not working...

Added code below at 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>

and below code at app\design\frontend\default\mobileshoppe\template\catalog\product\ view.phtml

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

I have tried the same with default theme and its also not working, can any one help me to figure out this issue ?

Thanks...


回答1:


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>




回答2:


Can you please replace xml reference content to left.

Instead of this

  <reference name="content">

Use below and check

  <reference name="left">

As it is a part of sidebar so it should work with left / right column as you want to display in page.

Cheers!



来源:https://stackoverflow.com/questions/19268891/how-to-display-recently-viewed-products-list-on-product-details-page-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!