I am trying to get all recently viewed product's id programmatically . I tried to check the reports/product_viewed and reports/product_abstract. But couldn't figure it out.

2 Answers 2


Try this code:

$collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed')->getItemsCollection();

  • can we add customer id filter with this ??? for getting specific customer recently viewed products Mar 25, 2016 at 4:59

If you like to get only the IDs and don't want extra logic from the block, you can try to use directly this:

$ids = Mage::getModel('reports/product_index_viewed')->getCollection()->getAllIds();

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.