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

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"

  • You can't imagin how much time I spent on this one. Thanks a lot for the great explenation. – HomTom Nov 6 '14 at 13:09
  • You r welcome... – Amit Bera Nov 6 '14 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 Nov 7 '14 at 13:31
  • No..it is magento feature – Amit Bera Nov 7 '14 at 13:33
-2

With CSS:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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