Magento get all url parameters

Use the below code to get all the URL parameters
$arrParams = $this->getRequest()->getParams();

When $this object is not defined then use the below code:
$arrParams = Mage::app()->getRequest()->getParams();

To get a specific parameter value use the below code. Say the parameter code is test
$arrParams = $this->getRequest()->getParam('test');

Magento get all url parameters

2 thoughts on “Magento get all url parameters

  1. Zam says:

    where do the code snippets go? (which files?) and would this work if using custom dynamic parameters like UTM_term={customKeywords}? In the case where the {customkeyword} section is a dynamic directive that pulls the paid keyword at the time a cpc ad is clicked?

    Like

Leave a comment