Skip Navigation

[Fixed in next Release] Map not behaving as expected

This support ticket is created 4 years, 5 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.

Our next available supporter will start replying to tickets in about 0.53 hours from now. Thank you for your understanding.

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: Africa/Casablanca (GMT+01:00)

This topic contains 29 replies, has 2 voices.

Last updated by Jamal 4 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1665679

I just noticed the Custom Search Setting was set to use a Search button and there is no Search button on the page. I had it set to "AJAX results update when visitors change any filter values", (no search button) which is what I want. I have changed it back, but the form still uses the user location even when I change it to something else.

#1666411

I deactivated AJAX yesterday while debugging to be able to generate the Toolset debug window, and I was simulating the submit button with code in the console. https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#the-views-debug-tool

Please note that the distance displayed in the results is calculated from your(the visitor) position. That's probably another issue and we can work on it too. But I'd rather prefer to focus on one issue on this ticket(sorting by distance).

From what I gathered so far, the distance ordering is working correctly(check my reply June 16, 2020 at 4:41 pm). If you think it is not, please, let us agree first and work on the same basis, I'll need a detailed step-by-step method to see the issue, as I have asked before:
1. I select ... in ...
2. Enter ... in ...
3. We expect to have ...
4. Instead, we get ...

Because from what I see, Philadelphia is closer to New York than Washington. Let's work on this sorting issue first and get it resolved. We can work on any other issues on other tickets.

#1666691
mylocation.jpg
Image3.jpg

The distance ordering for me is backwards, with the closest meeting *last*. See image3.jpg.

1. I select 25 miles as the radius.
2. Enter Philadelphia, PA, USA in toolset_maps_distance_center
3. We expect to have meetings displayed obeying the search criteria, sorted in ascending order with closest first, which in the case above, should be none.
4. Instead, we get the same 3 meetings from my location, sorted in descending order with farthest first.

The only way it works is if I click "Use My Location" See second screenshot. Then it sorts correctly. I cannot add any other address or coordinates.

#1666847

Thank you for your feedback, but I think there is still a misunderstanding on the displayed distance.

The distance ordering for me is backward, with the closest meeting *last*. See image3.jpg.

For me, the issue here is not the order, but the displayed distances(515.7 mi, 304.5 mi, and 11.3 mi). The order is correct, I expect to have this order: New York, Washington, then Pittsburgh.
These distances(515.7 mi, 304.5 mi, and 11.3 mi)are probably calculated based on your current position, so I assume that your current position is nearest to Pittsburgh, then Washington, then New York. Check this old screenshot(position in Morocco/Africa ), just focus on the calculated distance, not the order of the results hidden link
This is the return value of toolset-maps-distance-value shortcode, we should work on this and get it fixed too.

1. I select 25 miles as the radius.
2. Enter Philadelphia, PA, USA in toolset_maps_distance_center
3. We expect to have meetings displayed obeying the search criteria, sorted in ascending order with closest first, which in the case above, should be none.
4. Instead, we get the same 3 meetings from my location, sorted in descending order with farthest first.

For point 3, the view was not having a query filter on the distance. I added it now, check it on this screenshot hidden link
On the first load, when no search center is provided, the view will provide all the results. Once a search center and a radius is provided it will filter based on it (Philadelphia and 25mi will give no results).

The only remaining issue is the calculated distance, which is always performed against the visitor's current distance instead of the searched location. Do we agree with it? Or am I still missing something?

#1667003
sorted alphabetical.jpg
meetingdays.jpg

I see what you mean.

I think on load, when there is no criteria in the URL parameter "toolset_maps_distance_center", it is returning the results by address ascending, as in alphabetical order. 1800, then 301, then 4, then PNC (I added another test meeting with Wrigley Field as the address). That order has nothing to do with distance. See "sorted alphabetical.jpg". To test this theory, I bet if we changed the address on one of the listings, the sort order would change on load.

I fixed the distance values in the table loop. There was a geolocate tag around the value and it was set to go by user location. I changed it to the URL parameter and removed the geolocate tag and it works now, albeit it is blank until it has a location to search. I'm okay with that, unless there is a conditional output code that will return the distance only if there is a value in toolset_maps_distance_center.

So now here is the status:
What is working:
1. I load the page fresh
2. I select Use My Location in the search criteria
3. We expect to have filtered meetings obeying the search criteria
4. That is what we get.
5. Sort by Closest To Me works
6. Sort by Newest Meetings works.

Also working:
1. I load the page fresh
2. I select Sort by Meeting Day
3. We expect the order Every Day, then Sunday through Saturday
4. That is what we get.
5. Sort by Closest To Me works
6. Sort by Newest Meetings works.

What is not working:
1. I load the page fresh
2. I select Use My Location in the search criteria
3. I select Sort By Meeting Day
5. We expect the order Every Day, then Sunday through Saturday
7. Instead, we get Sunday, Friday, Monday, Every Day See "meetingdays.jpg"

#1667285

Awesome 🙂 Let's focus on what is not working:

What is not working:
1. I load the page fresh
2. I select Use My Location in the search criteria
3. I select Sort By Meeting Day
5. We expect the order Every Day, then Sunday through Saturday
7. Instead, we get Sunday, Friday, Monday, Every Day See "meetingdays.jpg"

It seems that the view is ordered by the ordering configuration(distance) instead of using the sorting controls that sort on different criteria(distance, date, custom field(meeting day))

From what I can gather so far, the sorting control does not support the distance unit yet. Check this screenshot hidden link

I am not sure if this can be supported. Let me check with our 2nd Tier to be sure if sorting by distance in the sorting controls is supported or not.

#1667341

Ok, so you're saying if we remove the distance portion of the sorting controls, that the Meeting Day sort will work as expected? I'm good with that since closest meeting is already loaded on search.

#1667343

Sort by Closest To Me does actually seem to work when a location value is entered into the distance center search. Of course it doesn't work before a value is entered because there is no location to start from.

#1668449

Ok, so you're saying if we remove the distance portion of the sorting controls, that the Meeting Day sort will work as expected? I'm good with that since closest meeting is already loaded on search.

The sorting by distance will always win, as it is configured on the view level.

Sort by Closest To Me does actually seem to work when a location value is entered into the distance center search. Of course it doesn't work before a value is entered because there is no location to start from.

Yes you are right.

I am approaching our 2nd Tier about this issue to get a second opinion and to confirm if this should be escalated to developers.

The main issue, here, is that sorting controls do not implement a distance measure. hidden link
This means that we cannot order results by distance from a central location unless we do it on the ordering option or the view. hidden link
When we add an ordering option for the view, it overrides the sorting options chosen on the sorting control and always orders results by distance.

Our 2nd Tier will look into this and we'll get back to you as soon as possible.

#1670001

We have filled a feature request to our developers to implement the distance ordering in the sorting controls of a view filter. I can't state an estimated date of when this will be released.

Our apologies for any inconvenience.

#1672139
4jerseyst.jpg
Image9.jpg
wrongdistance AND incorrectresults.jpg
actualdistance.jpg

Still trying to figure out how I can display this page to the public and have it work in some capacity. Even if I strip all the sorting capabilities from the page and only focus on distance and custom filters, the map still has several serious problems.

The distance calculation is wrong and the map is not obeying search criteria.
The distance between my location and the White House is 253.6 mi. See actualdistance.jpg
1. I select Use My Location
2. Enter 200 mi as a search radius
3. We expect to have results listed with correct distance, 253.6 mi (or even one of the other values)
4. Instead, we get 304.5 mi., which is over 50 miles too high. Even the Pittsburgh address has a wrong distance. (See Image9.jpg)

Further, why is a meeting that indicates 304.5 mi away showing on a search for a 200 mi radius?

It gets worse if I increase the radius to 500 mi.
1. I select Use My Location
2. Enter 500 mi as a search radius
3. We expect to have 2 results within 500 mi with correct distances
4. Instead, we get 4 results, two of which should not show, and distances that are much too high.

4 Jersey St (Fenway park) is 578.2 mi from my location (see 4jerseyst.jpg) . My map says it's 779.4 mi away (see wrongdistance_AND_incorrectresults.jpg).
Again, why is a location that says it's 779.4 mi away being allowed when I gave a radius of 500 mi?

Are there Google map settings that I have wrong somewhere? Are other people having any of these issues?

#1673217

The distance in the table is hardcoded to display (value mi away) and it seems that the distance is always calculated in km. Check this screenshot, one window is forced to calculate the distance in miles hidden link

I updated the distance shortcode to force calculation and display in the distance unit chosen on the search filter by changing:

([toolset-maps-distance-value origin_source='url_param' url_param='toolset_maps_distance_center' postmeta='wpcf-20fulladdress'] mi away)

To:

([toolset-maps-distance-value origin_source='url_param' url_param='toolset_maps_distance_center' postmeta='wpcf-20fulladdress' unit='[wpv-search-term param="toolset_maps_distance_unit"]'] [wpv-search-term param="toolset_maps_distance_unit"] away)

Check this screenshot for my last test from Pennsylvania in km. hidden link

Please check again and let me know if the distance is calculated correctly and the view respects distance filter. If it still fails for you, please share another example and let me check it.

#1673219
#1673297

That worked perfectly. I chose miles when I created the distance shortcode, so I didn't realize I needed to overrule the hardcoded km with an additional parameter. Thanks for fixing it. So I guess I'll wait for word of when the distance sorting will be implemented to work alongside my other meeting day and post date selections.

#1673725

Awesome! I'll set the ticket as fixed in the next release and I will check if it is fixed when we plan to publish a new version, then I'll get back to you. I have no estimated date for when this will be done. Thank you for your patience.