2

This is my code from my function from controller:

public function step3Action(){
     $redirectUrl = Mage::getUrl('returns/rma_new/step2', array('m'=>'-1'));
     $this->_redirectUrl($redirectUrl);
     $redirectUrl2 = Mage::getUrl('returns/rma_new/step2', array('m'=>'-2'));
     $this->_redirectUrl($redirectUrl2);
     $redirectUrl3 = Mage::getUrl('returns/rma_new/step2', array('m'=>'-3'));
     $this->_redirectUrl($redirectUrl3);
}

Why am I redirect always to returns/rma_new/step2 with the -3 parameter ? instead of returns/rma_new/step2 with the -1 parameter I am confused. thx

  • You are passing $redirectUrl3 so it will return always -3. – Suresh Chikani Nov 4 '16 at 13:32
  • how I redirect to my url with the -1 parameter? can you give me an example ? thx – Attila Naghi Nov 4 '16 at 13:33
  • Magento first read all code in action and after that it will redirect. in you case last one always last one will work. – Suresh Chikani Nov 4 '16 at 13:42
  • You have put some condition for that. – Suresh Chikani Nov 4 '16 at 13:43
0

Actually I forgot the add the return type:

public function step3Action(){
     $redirectUrl = Mage::getUrl('returns/rma_new/step2', array('m'=>'-1'));
     $this->_redirectUrl($redirectUrl);
     return $this;
}

If I add the return after my first redirect, the rest of them are ignored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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