The following code lets you determine the current page type (category, product, etc.) from a Magento 2 model:
|
1 |
$where = $this->request->getFullActionName(); |
The value of $where is, for example, catalog_product_viewwhen you are on a Magento product page.
Detecting the current page type in a model
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.