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');

Advertisements
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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s