问题
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 ?
回答1:
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>
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.
回答2:
Show recently viewed product anywhere with this code.
echo $this->getLayout()->createBlock("reports/product_viewed")->setTemplate("reports/product_viewed.phtml")->toHtml();
回答3:
You have two options. You can use layout XML to make the right.reports.product.viewed
block a child of the product.info
block and a getChildHtml() call to the catalog/product/view.phtml
template, or you can change the product page to a 2column-right layout.
回答4:
You can use an extension:
Atwix Recently Viewed Products Bar
It is free and will show all recent viewed products in footer.
来源:https://stackoverflow.com/questions/8050661/show-recent-viewed-products-on-product-page