Magento 2 - Get current page type
Frage
I have a title.phtml which loads the page title for the pages in the webshop. What I need to do is detect whether it's a product page or something else...
What is the best way yo do this?
Regards,
Lösung
if you are checking for just testing you can try this
echo $this->getRequest()->getFullActionName();
if you are at
Search page it will be -> catalogsearch_result_index
category page it will be -> catalog_catagory_view
product page it will be -> catalog_product_view
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange