Jump to content

Select multiple Order state in Order list view


Wotek

Recommended Posts

If you want that, you have to re-code the full code behind this function. It will have to go through the list of selected items, and then add them one after another to the status lists, with its change-date, its consequences for each status (like send email, validate order, etc, etc).

 

You also find a way to tell in which order it has to add the statuses, and what is the final status etc. 

 

All in all not so easy, I'm afraid...

 

My 2 cents,

pascal.

Link to comment
Share on other sites

Well, roughly:

 

In controllers/admin/AdminOrdersController.php, you will have to modify function:

 

public function postProcess()
 
 
Where it currently gets the single selected state:
 
/* Change order status, add a new entry in order history and send an e-mail to the customer if needed */
  elseif (Tools::isSubmit('submitState') && isset($order))
  {
    if ($this->tabAccess['edit'] === '1')
    {
      $order_state = new OrderState(Tools::getValue('id_order_state'));
 
 
What you could do, if you always want to add the same set of statuses , in this specific order, is to just select the last one (status with ID = 10) like you currently do, and then check if this last one is selected in above function. If so, go through this function with the other three fixed statuses first, and then add this final selected status to finish it.
 

so something like: (Sample code from PS 1.6.0.14), add red code:   (Make backup of the file first!!!!)

 

    if ($this->tabAccess['edit'] === '1')
    {
      $order_state_tmp = new OrderState(Tools::getValue('id_order_state'));
 

 

      $statusArr = null;

      if ($order_state_tmp == 10)    // check if chosen state = 10.

                                     // If so, add it with three other statuses

                                     // to an array we use to 'loop'

        $statusArr[] = array(4,5,8,10);

      else

        $statusArr[] = array($order_state_tmp);  // otherwise just add the chosen status to our array.

 

      foreach ($statusArr as $order_state) {    // make a loop for all statuses in our new array

        ... // old code to handle the status

      }

   }

 

   /* Add a new message for the current order and send an e-mail to the customer if needed */
   elseif (Tools::isSubmit('submitMessage') && isset($order))
   {
     ...
 
 
That should come close to what you need, I think. You may need to postpone the redirect we encounter in the original status change code until the last status change has been done:
  Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$order->id.'&vieworder&token='.$this->token);
 

I'll leave that as an exercise for you.

 

 

So, with fixed statuses and fixed adding-order, I think this may work. If you randomly choose statuses, it will be much more difficult, as described in my reply above. Haven't tried the code, but expect something close to this should work.

 

pascal.

Edited by PascalVG (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...