If this is your first visit, check our documentation. To post, register or login.

Sorting orders in admin

Started by colinr on 14 Mar 2013, 1:46 PM · Views: 858

Results 1 to 3 of 3
14 Mar 2013, 1:46 PM
#1
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Post #1 by colinr

Hi There,

I'd like to be able to sort the display or orders in the admin area by a field other than customer id. Is there a simple way to achieve this?

The source at /admin/orders.php suggests a value can be passed in using 'list_order' as a variable in the url:

// Sort Listing
          switch ($_GET['list_order']) {
              case "id-asc":
              $disp_order = "c.customers_id";
              break;
              case "firstname":
              $disp_order = "c.customers_firstname";
              break;
              case "firstname-desc":
              $disp_order = "c.customers_firstname DESC";
              break;
              case "lastname":
              $disp_order = "c.customers_lastname, c.customers_firstname";
              break;
              case "lastname-desc":
              $disp_order = "c.customers_lastname DESC, c.customers_firstname";
              break;
              case "company":
              $disp_order = "a.entry_company";
              break;
              case "company-desc":
              $disp_order = "a.entry_company DESC";
              break;
              default:
              $disp_order = "c.customers_id DESC";
          }

...but when I try it nothing changes.

Any help or advise would be much appreciated.

Colin

14 Mar 2013, 1:53 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #2 by ajeh

This is a start of adding Sort Order to the orders.php but it is not complete ...

At some point this will be completed to provide more flexibility to the Orders for how they are displayed ...

That code, at this time, is not used ...

You might look at the customers.php and how it works and what it would take to incorporate something like this into orders.php but it would require quite a buit of customization ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Mar 2013, 3:36 PM
#3
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Post #3 by colinr

Thanks Ajeh. As a temporary fix (and noted here for the benefit of others) I have modified the code in /admin/orders.php at lines 771, 784 and 797 to sort the results directly from the database. ie:

$search . " order by o.order_delivery_date DESC";
//$search . " order by o.orders_id ASC";

NB: This is intended to work with the delivery date mod but naturally could be used to sort using other fields.

Colin