Skip Navigation

[Resolved] Sorting not working for string or numeric fields?

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 25 replies, has 4 voices.

Last updated by Luo Yang 4 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1556099

OK, thanks for the heads up.

#1566931

Beda,
Apologies for the delay I am finally back able to work on this project.

I hope you are well, staying safe and healthy.

Well I have moved my view out of the archive page, and put it on it's own page, and I'm still having the sort issues.

For example - attempting to sort by Min Divisble (a custom non-toolset field, of type number), and it still seems to be sorting it as a string:

hidden link

I even tried clearing out all the sort fields, saving, and then starting fresh and re-adding the sort fields, and the issue still happens.
Any ideas?

Please help this is a crucial part of this app, and I have to present this coming week,
Do you allow payment? Let me know if there's anything I can do,
T

#1568817

Hello,

Beda is on vacation, I will take care of this thread, please check these in your website:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

4) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1572065

Luo Yang,
Thank you for your help here. I am working on your 4 suggestions, I will respond soon,
T

#1573145

Luo Yang,

Unfortunately as we have to launch and I've been working on this issue for weeks now, so I have to launch with this bug in the application and my patches (manually setting the string or numeric "meta_value_num" or "meta_value" in the query filter (in functions.php). This requires every sort field to be added to functions.php but at least it works.

To respond to your questions:
1) Everything is on the latest version
2) I can't deactivate all plugins (eg elementor is running the design and if deactivated the entire site breaks), but I've tried deactivating all the others and still the issue persists.
3) There are no errors in either js or php
4) It would be easier for me to setup a dev environment and just give you access to that
I will do that if that works ok for you?

#1573393

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I was looking at this thread to see if I could help expedite a solution, but when I tried the credentials you set up in a private field earlier to look at your site they did not work.

It would certainly help to have a staging site for testing, or you could make a copy of the site for installing locally as Luo mentioned in his final comment (which may be necessary in any case).

If you are able to generate a backup with Duplicator as per the linked instructions, please do so, but if not please set up a staging server for testing.

I'll set up another private reply for you to share the staging site credentials or a dropbox link (or similar) to the duplicator packages.

#1575099

The private message box is enabled again, you can provide the duplicator package or staging site credentials. thanks

#1576997

Luo Yang,

In about an hour the entire site will be accessible here:

The problem can be seen on the Listing Search page:
(click on Listing search at the top once you're logged in)

Specifically if you sort by any string column (eg address or property name, then try to sort asc or desc by a numerical field (eg min divisible, or max contigous) the sorting is not working (sorts by string for numbers and fails to sort by string in some cases).

As soon as that server is ready, I'll comment out my fixes in the wpv_filter query in functions.php so you can see the problem happening.

Feel free to edit or change anything on that server, no one is on it but you,
T

#1577093

Luo Yang (do you prefer Luo or Yang? sorry),

The password for your wordpress user, I had to make it stronger. It is: 8OzSKYe$v0()XYVsQ50@$!2L

Also just anote that to access wordpress, go directly to the login page:

hidden link

And also note that you may have to login to the site (the popup login) a few times, if you don't visit http, it redirects you and you have to login twice for that.

Let me know if you need anything else,
T

#1577095

Luo,
Then after logging, you'll be able to access the Listing Search page:
hidden link

#1578091
sort-by.JPG

Thanks for the details, I have removed the credentials from your post, it is not safe to share them publicly.

I can login your website, here are detail steps I tried:
1) Goto URL
hidden link
reveal the HTML div tag "sort-links" of sortby control inputs,

2) Choose options:
- Min_Divisble
- Descending
Click button "sort", I can see it works fine, all results are sorted correctly in column "Min Div", see screenshot sort-by.JPG

Is there any missing steps?

You can call me "Luo", thanks