title: Errors lost during redirect in Prestashop
body: <p>I have overridden the Prestashop ordercontroller.php file.</p>
  
  <p>There is a switch statement in it which performs certain tasks based upon the number of step we are in.</p>
  
  <p>When i am on step 1 i need to go back to step 0 if there are certain errors. Now if i redirect to the step 0 the errors i set get lost. I am setting errors as below.</p>
  
  <pre><code>if(some condition)
  {
        $this-&gt;errors[] = 'There is an error';
        Tools::redirect('index.php?controller=order');
  }
  </code></pre>
  
  <p>What i think happens is that prestashop generates a new request in the redirect and the errors set in the controller are lost. Now there is an other option to change the step and the switch statement but as a case statement is already being executed it seems impossible to me how to switch the step.</p>
  
  <p>Example code:</p>
  
  <pre><code>  switch($step)
    {
         case 0:
                //load the step 0
                break;
  
         case 1:
                //load the step 1
                checkforerrors();
                break;
  
         case 2:
                //load the step 2
                break;
  
         case 3:
                //load the step 3
                break;
    }
  </code></pre>
  
  <p>Now the function checkforerrors() in step 1 want to shift to step 0.</p>