Aug 22, 2012
kalpesh

Magento: Get route name, module name, controller and action name from URL

Getting route name, module name, controller name and action name is very easy in Magento. You can get these values anywhere, in controller itself and also in template files.

Mage::app()->getRequest()->getControllerName();

Mage::app()->getRequest()->getActionName();

Mage::app()->getRequest()->getRouteName();

Mage::app()->getRequest()->getModuleName();

1 Comment

  • How we print the the current module name with it’s package name?

    like module shows “catalog” its become a “Mage_Catalog”

Leave a comment

 

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications

Honor

Recognition

Magento top 50 contributors

Magento top 50 contributors

Contributions