Magento 2.3.4

Is it somehow possible to get the current page in a model? I am using some sort of page speed optimizer and want to disable some of its features on the product page. I checked the code and the place to do that would be in a model class.



I would start looking in the page Request.

For example $this->getRequest()->getFullActionName() might give you what you need.

On a product page this will result in: catalog_product_view

  • $this->request->getFullActionName(); did the trick – EOB Dec 1 '20 at 9:52

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.