Magento get recently viewed products

1. Place the code snippet below in any template page want to add (like view.phtml )


<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>

2.Place code snippet below in any Backend cms-> page or static block


{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}

Your Recently Viewed Products

Step 1 : Go to Admin ->CMS->Pages->AnyCmsPage

Step 2 : Go to-> AnyCmsPage-> Design

Step 3 :Copy and Pase the following code in Layout Update XML

<reference name="content">
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new">
            <action method="addPriceBlockType">
                <type>bundle</type>
                <block>bundle/catalog_product_price</block>
                <template>bundle/catalog/product/price.phtml</template>
            </action>
        </block>
</reference>

Remove Recently Viewed Products From Right sidebaar

If You wnat to remove Recently Viewed Products From Right Side baar Go To

app/design/frontend/Yourpackage/yourtheme/layout/reports.xml

Find the section:

<reference name="right">
  <block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
  <block type="reports/product_compared" before="right.permanent.callout" name="right.reports.product.compared" template="reports/product_compared.phtml" />
</reference>

comment out the code :

<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />

Categories: Magento

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *