Sort order of Product Status when updating orders.

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Sort order of Product Status when updating orders.

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Sort order of Product Status when updating orders.

Post 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.
User avatar
burt
Core Team
Posts: 4557
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Sort order of Product Status when updating orders.

Post 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).
User avatar
burt
Core Team
Posts: 4557
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Sort order of Product Status when updating orders.

Post 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.
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Sort order of Product Status when updating orders.

Post 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?
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Sort order of Product Status when updating orders.

Post 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
User avatar
burt
Core Team
Posts: 4557
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Sort order of Product Status when updating orders.

Post 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).
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Sort order of Product Status when updating orders.

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply