Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Shaun

Problem with sorting WooCommerce orders by date / order_date

We had a problem sorting WooCommerce orders, because your plugin once activated changes the “date” field to be “order_date”.

This causes issues with the orders being shown out of date order – I don’t think order_date is valid.

I edited line 136 of /admin-columns-pro/classes/sortable/classes/post.php and changed ‘order_date’ to just ‘date’ this has fixed the issue.

Can you please make sure in your next update you make this change too? Otherwise it will break for me again.

Thanks
Shaun

7 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

Hi Saun

Thanks you very much for your feedback.
I will try to reproduce the issue and see if this fix is valid.
If so, the fix will be merged and tested into the upcoming release.

7 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

Saun,

I tried to reproduce this and I think it is working as it should be.
When I look at the order overview with and without our plugin the results are sorted the same when I sort on nothing and when I sort on the date field.

The logic we’ve added for the date column only makes the default WooCommerce date column, which is the order_date, appear sortable on our admin page. The line you’ve changed in our code should make no difference on how something is sorted on the overview. Can you confirm that changing that line in our code did change something on your overview? And can you make some screenshots for me so I can see what you mean? Please send them to support@admincolumns.com.

7 years, 4 months ago
Shaun

Hi

If I sort by order_date, then orders are sorted in the wrong order – it seems that new “order notes” changes the order_date so old orders with new order notes are higher up the list than they should be.

You might not see this in testing if you don’t have old orders with newer order notes. Please see the screenshot.

Order date incorrect

https://dl.dropboxusercontent.com/u/1484138/order_date.jpg

Regards
Shaun

7 years, 4 months ago
Shaun

It mainly happens when you sort by the ORDER not be the DATE column. I can’t seem to reproduce it when sorting by DATE anymore, but that had an issue before.

7 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

Hi Shaun,

I can see in your screenshot that sorting on date does not give the correct or expected result.
But both sorting on the order or on the date column are default WooCommerce columns.
I’m not sure how the Order column is sorted, but it does nothing with the order date.

Can you please confirm that if you disable our plugin, that everything works fine or that is works the same?
As I said, I cannot reproduce the issue and see no difference when I sort on the order and date column with our plugin activated and deactivated.

7 years, 4 months ago
Shaun

Hi, yes when I remove the plugin it goes back to working as expected.

The only way for you to test it is to add Order Notes to an old order, you’ll see it jump up to higher up in the list. This is definitely a bug, and changing “order_date” to “date” on line 136, as I mentioned in the original post, fixes it completely. Please change it so I don’t have to do this myself every time the plugin updates.

Regards
Shaun

7 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

Hi Shaun,

Ok I did some further research and I am now able to reproduce the issue and yes, this is definitely a bug. So thank you very much for addressing this to us. I also understand that changing the line you mentioned will fix the bug for you, but this will break some other things. You can remove all the WooCommerce lines in that file and sorting will work for both the ID, date and total column, but it also won’t allow you to disable sorting for those columns.

The problem here is that mapping for column and param that is used for sorting is not matched properly. We’re currently working on the 4.0 release and I can tell you that this issues is tackled in this release. We’re probably not going to fix this in the current 3.* release but we can make a decision if we’re going to remove those lines in the code or not.

After all, I believe that working sortable columns that can not be disabled are better than sortable columns that are not working :)

Thanks again for bringing this issue to our attention, we really appreciate it!

7 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

A Quick fix is added to the 3.8.9 release. A more sustainable fix will be available in 4.0.

7 years, 4 months ago
Shaun

Hi,

3.8.9 didn’t seem to solve this at all for us.

Regards
Shaun

7 years, 3 months ago

You must be logged in to reply to this topic.