I am trying to remove a parameter under certain conditions when it is passed to my controller. The var_dump of the request contains all the parameters. The parameter I want to remove is called super_attribute. Let's take a look at that var_dump shall we?

[product] => 10
[form_key] => XXYY
[related_product] => 
[super_attribute] => Array
        [220] => 1141

I am able to set the product parameter to another figure using:

$this->getRequest()->setParam('product', $product->getId());

However, I would like to know a way to altogether remove the super attribute or null it's array, heck, or even just change the values contained within! For starters:

$this->getRequest()->setparam('super_attribute', null);


$params = $this->getRequest()->getParams();

hold any water.

  • 1
    Try $this->getRequest()->setPost('super_attribute', null). If that don't work take a look at setRequest(Mage_Core_Controller_Request_Http $request) Oct 29, 2014 at 21:12

1 Answer 1


Look how method Zend_Controller_Request_Http::getParams works:

public function getParams()
    $return       = $this->_params;
    $paramSources = $this->getParamSources();
    if (in_array('_GET', $paramSources)
        && isset($_GET)
        && is_array($_GET)
    ) {
        $return += $_GET;
    if (in_array('_POST', $paramSources)
        && isset($_POST)
        && is_array($_POST)
    ) {
        $return += $_POST;
    return $return;

It all time gets parameters from global array and doesn't store it in class properties.

So there are two options you have:

  • change $_POST strictly (eg if (isset($_POST['super_attribute'])) { unset($_POST['super_attribute']); } ).
  • or you can use $this->getRequest()->setPostValue('super_attribute', null). In that case key super_attribute wont be removed from $_POST array, but will be modified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.