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.


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 – SagarPPanchal Mar 25 '16 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, privacy policy and cookie policy

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