• Create Recently Viewed Products for Model file in Magento 2 ?

Create an API with Mage2Gen


Now you can add the logic in


Based on the following function in which a Recently Viewed Product Collection is returned when a Customer Id is available. Don't include the class in your construct because it is a block but copy it and add your own logic.

getItemsCollection in vendor/magento/module-reports/Block/Product/AbstractProduct.php

Then retrieve the current Customer Id through the


| improve this answer | |
  • Can you be more specific with Business Logic ? – Yann Martel Dec 10 '18 at 6:32

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.