0
votes

I'm using default magento 1.9.x Recently Viewed Products block on a CMS page

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

But default magento Recently Viewed Products block only support for logged in users, so it only show when i logged in

I checked the file

/public_html/app/code/core/Mage/Reports/Block/Product/Abstract.php

and It's line number 138 function set a customer id for product collection for filter the results.

But i think normal site visitors not have that kind of id.

if ($this->getCustomerId()) { 
                       $this->_collection->setCustomerId($this->getCustomerId());
 }

Anyone know how to get recently viewed products by setting an id to above or by using another way.

i also tried this answer but it didn't work at all

How to get Recently View Product For Guest User In Magento

1
Can you tell me after try that code, which error you are facing?Dhiren Vasoya
not getting any error, just nothing happens when i change that codes inside "protected function _toHtml()" function according to answerSuneth Kalhara
Have you debug the code, what that function return?Dhiren Vasoya

1 Answers

1
votes

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>