Skip Navigation

[Resolved] distance filter don't work correctly

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 25 replies, has 3 voices.

Last updated by Minesh 1 year, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2703304
Capture d’écran 2024-06-19 145656.png
image (2).png
image (3).png

Hello
When I try to search by distance, the location doesn't seem to work or shows me the wrong location.

The bug appeared on Monday even though I haven't made any changes to the page since last Thursday.

It's complicated to explain, but it seems that the location with Google is wrong when we do a search on Paris in France for example, it takes us to a location in the middle of the Atlantic.

Besides that, all other filters work without problem.

Here is the url or error for this product: hidden link.

I looked in the console and noticed several warnings regarding “google.maps.marker” and “google.maps.marker.AdvancedMarkerElement”. I've attached a screenshot, but I think you could find the information yourself.

Following the bug, I decided to hide the map while I found a solution to my problem, but you could find it in the 2nd column with a display none.

Thank you in advance for your answer

#2703341

Nigel
Supporter

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

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

Hi there

Do you have a staging server where we could investigate this properly?

I wouldn't want to be making changes on your production site.

Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

#2703617

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

*** Please make a FULL BACKUP of your database and website.***

I see you are using WP Rocket plugin. Here is the Doc that you should follow:
- https://toolset.com/faq/how-to-use-optimization-plugins-with-toolset/

Can you please exclude those said files and check if that help you to resolve your issue.
- If no:
- In order to minimize the cause of the issue and to ensure there is no conflict between the plugins or theme you use:

Could you please try to resolve your issue by deactivating all third-party plugins one by one as well as switch to default theme to check for any possible conflicts with any of the plugins or theme?
- Do you see any difference?

#2703653

Hello, yes, I have made a complete backup of the site and the database.

I temporarily deactivated WP rocket, but that doesn't change anything.

I also deactivated some non-essential plugins, but that didn't change anything. Since the site is online, I cannot deactivate certain important plugins.

It's weird, because on Friday everything still worked fine and since no plugin was added to the site, the bug appeared Monday morning without any major changes to the site.

The only change that was made was to go from Astra to Astra Pro. Could this have been the cause of the problem?

#2703656

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It seems the following known issue is related to you:
- https://toolset.com/errata/map-markers-lost-after-applying-search-filters-on-custom-archive/

What if you set your view's Custom Search settings to "Full page refresh when clicking Submit" and save your view and check if that helps to resolve your issue.

#2703680

In fact, the problem is very similar, which is why I already tried this solution before contacting you, because it did not resolve my problem.

Actually, the weird thing is that no matter how I use the distance filter, it doesn't work.
The issue seems to come from a back problem, not a front problem.

#2703682

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

We do not recommond to debug issue on production sites so I urge you to create a staging site that should be 1:1 copy of your production site and send me access details where I can debug the issue further and disable the other plugins.

However - to check the issue is with that view only or sitewide, what if you try to create another test view and add distance search to it and check if that works as expected.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2704079

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you have added map markers as given under inside the view's loop:

[wpv-map-marker map_id='map-9' class='js-wpv-addon-maps-focus-map js-toolset-maps-open-infowindow-map-9-marker-[wpv-post-id]' marker_id='marker-[wpv-post-id]' marker_icon='//coopleo.care/wp-content/uploads/2023/05/icone-localisation-min-simple.png' marker_icon_hover='//coopleo.care/wp-content/uploads/2023/05/icone-localisation-min-simple-jaune-big.png' marker_field='wpcf-therapeute-lieu-2-affichage-moteur-de-recherche']

I also checked the actual map field name is "Thérapeute - Localisation" where slug of the address field is: localisation
- hidden link

The point should be noted here is the address field "Thérapeute - Localisation" is a repeating field so it have multiple values.

For example - check the following post:
- hidden link

I see there is multiple values assigned with the address field "Thérapeute - Localisation".

So, I've created the following test page and created a test view:
- hidden link

Where I've added the "Fields and Text" block to add the map marker shortcode with correct field slug:

[wpv-for-each field="wpcf-localisation"]

[wpv-map-marker map_id='map-12' marker_id='marker-[wpv-post-id]' address='[types field='localisation' output='raw'][/types]']

[/wpv-map-marker]

[/wpv-for-each]

When I checked on frontend the test page I've created I can see it does display the correct marker:
- hidden link

Can you please try to display marker as I shared above and adjust the code accordingly and check if that help you to resolve your issue.

#2704106

Thank you for your reply,

or indeed on the test page the markers seem to work on the map.
I tried to add a filter by distance on the test page and the same bug as on the main page appears. The markers disappear and the filter does not apply or applies incorrectly.

just here :
hidden link

#2704115

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I just disable the view's cache and I can see the expected result now:
- hidden link

#2704127

It seems to work strangely, on the address you gave me it works, but on the address of a city it does not work, even using the location it does not work.

Example with different cities:
Versailles:hidden link

Valence : hidden link

#2704286

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm not sure yet how the address field values are setup. Maybe you must have imported the address field.

Example with different cities:
Versailles:hidden link
========>
As when I checked the following post which was belongs to address "67 Avenue du Maréchal Douglas Haig, Versailles, France" but when I edit the post the address field value available with the field but I've to save the field.
- hidden link

Toolset Maps plugin is using anther custom database table "wp_toolset_maps_address_cache" to store the address coordinate values(latitude and longitude). The address coordinate values will be generated and stored/cached into database automatically when you display the address field as marker of a map.

Then when I search with "Versailles, Versailles, France" I can see the result.
=> hidden link

You may check with another city you mentioned and check what post has that address and check if that correctly saved.

#2704307
Capture d’écran 2024-06-25 113716.png

No, the address field has not been imported.

But yes, it's weird in the posts, the iframe maps in front of the address is always grayed out.
If I update it and save, the maps appear, but all I have to do is refresh the page for it to be grayed out again.

Could the problem come from there?

#2704312

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - possibly, it looks like that way.

As I do see there is no such other tickets. If you want I'm happy to share sandbox site where you can try to build the distance search and it should work.

Here is a sandbox site and you can auto-login to it using the following link:
- hidden link

You can setup such custom search with map and check if you able to reproduce the same behavior with the shared sandbox site.

#2704356

So, I recreated a test page with a search by distance, the filter seems to work with the posts that I added by hand, but not with what I imported, I imagine that it is linked to a cache problem.
Page right here:
hidden link

Now the question is why it works on the test site and not on my site, even though the configuration is the same.
Did you need PHP error logs?