1

I'm trying to remove the "Recently Viewed Products" from all pages using local.xml but show it only of Product View page.

I display "Recently Viewed Products" on Product View Page using:

<catalog_product_view translate="label">    
    <reference name="content">         
        <block type="reports/product_viewed" name="right.reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml" />     
    </reference> 
</catalog_product_view>

Now to hide it from all the other pages I use following code:

<default>
<reference name="right">  
    <remove name="right.reports.product.viewed" />
</reference> 
</default>

But than it disappears also from Product View page!

How can I achieve that Recently Viewed Product is hidden on all pages except of the Product View Page?

Thanks

2 Answers 2

2

HomTom just change the block name name="right.reports.product.viewed" fro this code

<block type="reports/product_viewed" name="right.reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml" /> of product page .

As two blocks have same name to it.<default> handler is working also on all frontend page

Default handler is also remove Recently Viewed Products from product page view

So,change

<catalog_product_view translate="label">    
    <reference name="content">         
        <block type="reports/product_viewed" name="right.reports.onlyproduct.viewed" as="recently_viewed" template="reports/product_viewed.phtml" />     
    </reference> 
</catalog_product_view>

name="right.reports.product.viewed" change to name="right.reports.onlyproduct.viewed"

4
  • You can't imagin how much time I spent on this one. Thanks a lot for the great explenation.
    – HomTom
    Commented Nov 6, 2014 at 13:09
  • You r welcome...
    – Amit Bera
    Commented Nov 6, 2014 at 13:13
  • Your solution is great, however I had to add this in to my local.xml to get it work: <remove name="left.reports.product.viewed" /> I guess this is a Magento Bug.
    – HomTom
    Commented Nov 7, 2014 at 13:31
  • No..it is magento feature
    – Amit Bera
    Commented Nov 7, 2014 at 13:33
-4

With CSS:

.block-viewed {display: none; }
3
  • 1
    This is bad advice.
    – Marius
    Commented Mar 7, 2018 at 15:25
  • This is not a feasible solution. Commented Mar 7, 2018 at 16:13
  • It worked for me
    – Em Jay
    Commented Mar 8, 2018 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.