In my Magento v1.9.1.0 CE I want to edit the recently viewed file so that is does not show any recently viewed products from a specific parent category and all its sub categories.

Meaning say I have a parent category called 'Members only' category and a sub category in that parent category called 'tshirts'. If I then view any items in the 'Members only' or the 'tshirts' subcategory I do not want them to show up in that persons recently viewed items listing.

I am thinking I need to edit the file app/design/frontend/my_theme/default/template/reports/product_viewed.phtml file to have an if statement that looks for the category id and then have an if statement that says if the category id == xyz then show an epty

  • tag else show the regular
  • tag with the product info.

    However I am not sure how to get the category and or subcategory id from the product that would be showed.

  • 0

    1 Answer 1


    If you like to edit the template you mentioned, this is the if that you are talking about :) ->

    <?php if (!array_intersect($_item->getCategoryIds(), array(categoryid3, categoryid3, categoryid3))): ?> //paste it below <?php foreach ($_products as $_item): ?>

    and close if with <?php endif; ?> above <?php endforeach; ?>.

    Your Answer

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

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