I want to get particular section collection which is already rendered in Magento 2 website

enter image description here

I need collection for my another phtml file, how to get the collection?

1 Answer 1


You have a few options here:

  1. Use a debugger (xdebug) - Set a breakpoint in the template file and go back on the stack trace until you find where the products are loaded.
  2. Use blackfire.io - install the agent on your machine , enable it and load the page of interest. The tool will provide a detailed graph which will allow you to see all the called classes and methods.

Good luck!

  • I need wishlist side bar section, path is :vendor\magento\module-wishlist\view\frontend\templates\sidebar.phtml in this file helper function available, how to use the helper class into my custom phtml file and get the wishlist data?
    – zus
    Mar 25, 2021 at 9:10
  • the helper function is : $wishlistHelper = $this->helper(\Magento\Wishlist\Helper\Data::class); how to use into my custom phtml file?
    – zus
    Mar 25, 2021 at 9:11
  • Can i get any help thanks magento.stackexchange.com/q/333565/57334 @Diana Botean
    – zus
    Mar 26, 2021 at 4:08

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.