In my product list template I need the current category. I was searching around and the recommended way is to inject the registry into the current block's constructor. Example: https://magento.stackexchange.com/a/101694/59108

But I am using the default ListProduct block. Do I really have to override the block class only to get the current category?

Everybody is hailing dependency injection but it just keeps biting me in my behind whenever I have to do the simplest of tasks. I really don't see the upside.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.