在产品页面上显示最近浏览的产品 [英] Show recent_viewed products on product Page
问题描述
的magento的当前的默认功能是,它示出了类别页面的右侧的最近查看的产品.现在,我想在显示产品页面底部的相同内容.所使用的文件PHTML在位置被命名为
The Current default functionality of magento is that it shows the recently viewed products on right side of category page. Now I would like to display the same content on at the bottom of product page. the phtml file used is named at location as
frontend/base/default/template/reports/product_viewed.phtml
.
有没有什么简单的方法来做到这一点?
Is there any simple way to do it ?
推荐答案
在你的主题,您将修改catalog.xml文件(/应用程序/设计/前端/{你的主题}/default/layout/catalog.xml).找到以下部分,并在内容引用的底部添加对模板的块调用.
In your theme you will modify the catalog.xml file (/app/design/frontend/{your theme}/default/layout/catalog.xml). Find the following section and add a block call for the template towards the bottom of the content reference.
<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/template/catalog/product/view.phtml中,添加以下行,以在其中显示最近查看过的"产品.
Then you need to modify your theme for where you want the block to show up. In /app/design/frontend/{your theme}/default/template/catalog/product/view.phtml add the following line where you want the Recently Viewed products to show up.
<?php echo $this->getChildHtml('product_recently_viewed') ?>
这会得到它显示,但你可能需要调整模板一点,因为它是专为左侧立柱,不得如果布局正确,你将其插入中间的一个.
That will get it to show but you may need to tweak the template a bit because it is designed for the left column and may not layout properly if you insert it into the middle one.
这篇关于在产品页面上显示最近浏览的产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!