Page 1 of 1

Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 11:22 am
by 14Steve14
Using 1.0.8.20

Is there a way to sort the order of the Product Status's when updating an order. Currently when you click on the order status section of the order update page the status's are in an unorderded list.

Is there an easy way of soring them without changing core?
order-status-sort.png

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 1:19 pm
by ecartz
They are sorted by orders_status_id: https://github.com/CE-PhoenixCart/Phoen ... us.php#L31

So just change that order in the database. Of course, that would be easier in a brand new store than an existing store, where you'd also have to update all uses of orders' status to match.

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 1:34 pm
by burt
I've not tried, but I wonder if the file to which Matt links, could be overridden?
Then change sort by ID to sort by Name (in that SQL).

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 1:37 pm
by burt
burt wrote: Sun Mar 03, 2024 1:34 pm I've not tried, but I wonder if the file to which Matt links, could be overridden?
Then change sort by ID to sort by Name (in that SQL).
Of course, if that (overriding the file) is doable;

Could the orders_status page be hooked to add in (eg) a Sort Order input box for each Status, then sort by Sort Order in the overridden file.

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 3:00 pm
by 14Steve14
burt wrote: Sun Mar 03, 2024 1:34 pm I've not tried, but I wonder if the file to which Matt links, could be overridden?
Then change sort by ID to sort by Name (in that SQL).
How does one go about over riding an admin file as I didn't think it was possible to override these files?

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 3:20 pm
by heatherbell
14Steve14 wrote: Sun Mar 03, 2024 3:00 pm How does one go about over riding an admin file as I didn't think it was possible to override these files?
https://github.com/CE-PhoenixCart/Phoen ... ding#admin

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 3:55 pm
by burt
Going by that help page, drop a copy of;

admin/includes/classes/order_status.php

to;

admin/includes/classes/override/order_status.php
Note you will most likely need to create the override folder.

Then change L31 in that new file so that the end bit is;

Code: Select all

ORDER BY orders_status_name
And that should do it, see if it works.

If you wanted to go the extra mile and have sort ordering, it would mean a new column in the orders_status table "sort_order" and a hook to insert an input box (and save the sort order number when editing or adding a new status).

Re: Sort order of Product Status when updating orders.

Posted: Sun Mar 03, 2024 5:44 pm
by 14Steve14
burt wrote: Sun Mar 03, 2024 3:55 pm Going by that help page, drop a copy of;

admin/includes/classes/order_status.php

to;

admin/includes/classes/override/order_status.php
Note you will most likely need to create the override folder.

Then change L31 in that new file so that the end bit is;

Code: Select all

ORDER BY orders_status_name
And that should do it, see if it works.
That does indeed work. Many thanks to everyone. yet another job ticked off the ever increasing to-do list.