0

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.

Possible?

1 Answer 1

1

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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