Search code examples
phpmagento-1.4magento-1.5magento

Show recent_viewed products on product Page


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 ?


Solution

  • 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.