Skip Navigation

[Resolved] Map search View results are not sorted correctly according to distance

This support ticket is created 4 years, 1 month 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 13 replies, has 3 voices.

Last updated by Luo Yang 4 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1802311

Good day.
I have several problems with displaying custom post types in Views (created with Blocks) and their filters.
This view is installed on my website

hidden link

and is supposed to show posts of the user-defined post type "Parking spaces" on a map and in the output in a user-defined archive ("List of parking spaces").

In the output of the view, I installed a sorting according to the distance from the user's location.
The listing refers to the "Address" field
However, the output of the sort does not work correctly. The contributions are not issued in ascending or descending order exactly according to distance.

I ask for help in solving the problems.

Kind regards

#1803365

Hi, I'll need you to resolve the JavaScript error I mentioned in another ticket first so I can continue debugging the sort order issue here. Please also provide a screenshot of the View editor area so I can see how you have the sorting system configured in the View editor or Blocks editor. Or if you provide login credentials in the speed ticket I can use those to look in wp-admin and see how this is configured.

#1803407

Hello,

On the subject of "JavaScript errors", I can inform you that the website's theme actually has an integrated time display, which I have deactivated in the theme customizer.
I will temporarily activate the display so that you can check whether the error is still there.

Kind regards

#1803409

Hello,

I have just reactivated the time display in the Theme Customizer. Please check whether the Js. error still affects the functionality of the website.

Kind regards

#1803421
Screenshot_Field_distance.png
Screenshot_Field_distance (1).png

Hello,

as requested the screenshots of the filter settings "Search within distance" with sorting.

Kind regards

#1803553

I have just reactivated the time display in the Theme Customizer. Please check whether the Js. error still affects the functionality of the website.
Yes, the problem is still occurring. One way to resolve this for now is to update the JavaScript file that is producing an error. You can comment out the offending code in /wp-content/themes/newsup/js/custom.js by adding two slashes at the beginning of line 152 like so:

//document.getElementById("time").innerHTML = d.toLocaleTimeString();

Then upload that modified file on your server.

#1803569

Hallo,

ich habe die Zeile 152 eben auskomentiert.

MfG

#1803729

Okay thank you, the error I saw repeating has been resolved. Regarding sorting by distance, this feature is only possible in classic Views and has not yet been implemented in the block editor. It is on our developers roadmap, but has not yet been created yet. To use distance sorting, you must use the classic Views editing experience.

Even in classic Views, however, front-end sorting controls do not include distance sorting. You have the ability to use sort by distance in the backend, but there is not an option for creating a front-end sorting control that sorts by distance. Sorting by address field, as you have currently set up your View, is not sorting by distance. It's sorting by address, alphabetically, which doesn't really help you in this case.

Additionally, Relevanssi hijacks search result order in Views that use text search, so distance sorting is not fully supported:
https://toolset.com/documentation/user-guides/views/searching-texts-custom-fields-views-relevanssi/#integration-with-custom-searches

So to recap:
- Sorting by distance is not possible in Views created in the Blocks Editor. Only Views created in classic experience have this feature.
- Front-end sorting by distance is not possible in either Views created in the Block Editor or in the classic experience.
- Relevanssi can have an impact on search results, so be aware of this limitation.

#1807657

Hello,
it's very annoying that sorting by distance doesn't work. I use geolocation to display the distance in the posts and archives. These values ​​seem to be correct. Why can't you access this value when sorting? I am skeptical about the creation with the classic view. According to Tollset's recommendation, it is not the future. I had already tried the classic view. There are also various problems. For example, the filtering by distance does not work here.
See here: hidden link .

However, this page loads a little faster.

Kind regards

#1809889
distance-filter-map.JPG

Hello,

I have tried the URL you mentioned above, it seems to be work fine, here is my screenshot: distance-filter-map.JPG

What should the map display? is this problem resolved?

Please let me know if you need more assistance for it, thanks

#1816479

Hello,

in a classic view (hidden link) you can preset a sorting in the backend which also works. However, sort controls in the backend don't work. With a view created with blocks (hidden link), no sorting works.
Overall, this is unsatisfactory.

Kind regards

#1817609

I have tried the URL you mentioned above:
hidden link
I get 404 error.

Same as your another thread:
https://toolset.com/forums/topic/problems-with-views-and-filters/

Please provide your website copy in above thread, I need to duplicate the same problem and debug it in my localhost

#1818155

Hallo, die richtige URL lautet:
hidden link

Die gewünschte Kopie meiner Website werden Sie auch noch erhalten.

MfG

#1819841

Thanks for the details, it is a known issue, if you order the result by distance in backend, then the front-end sortby will not work, we have a feature request for it, I have added this thread into our to-do list, hope it will raise attention.