Skip Navigation

[Resolved] Display distance from location on results

This support ticket is created 5 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 5 replies, has 2 voices.

Last updated by Luo Yang 5 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1184015
Screenshot 2019-01-14 22.50.59.png

Tell us what you are trying to do?
Display distance from the current location on each result in list

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/maps-shortcodes/#toolset-maps-distance-value

I have placed the following shortcode in the Loop Template:
[wpv-geolocation]
[toolset-maps-distance-value origin_source='visitor_location' postmeta='wpcf-provider-address']
[/wpv-geolocation]

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1184119

Hello,

Thanks for the details, I have checked the URL you mentioned above.
I assume we are talking about the texts "Your Location Is Needed To Show This Content.", it means Map plugin does not get user's location data, so it output those message.

And there is a JS error in your website:

Uncaught TypeError: $ is not a function
    at (index):1654

Since Toolset Map plugin depends on Jquery Javascripts framework, please try these:
1) Make sure you are using the latest version of Toolset plugins
2) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2019, and test again
3) If the problem still persists, please provide database dump file(ZIP file) of your website, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1184224

Thanks for looking into:

1. The latest versions are currently installed
2. The JS error is coming from this line, once I remove it the JS error goes away.
[wpv-geolocation]
[toolset-maps-distance-value origin_source='visitor_location' postmeta='wpcf-provider-address']
[/wpv-geolocation]
3.This was a multisite install, I use WP DB Migrate Pro which allows me to export a single site to which I did the domain for the site is cbf.stagetwo.carpenters.local

#1184875

Thanks for the details, I can duplicate the same problem in a fresh wordpress installation, and have escalated it, will update here if there is anything news.

#1184974

Here is update from our 2nd tier supporters, we need more details:
Does this happen after… update, or since ever? I think this used to work not long ago, correct? Do you know if this started happening after (any actions)?

Thanks

#1184997
Bildschirmfoto 2019-01-16 um 11.06.38.png

There is a problem here:
I am in China, since the google map is blocked in China, I see the error message: The location of the current visitor
hidden link

But our other supporters are not be able to see the same error in above page, they can see the distance numeric value correctly, see screenshot: Bildschirmfoto 2019-01-16 um 11.06.38.png

Above test site is using same shortcodes as you mentioned above:

[wpv-geolocation]
[toolset-maps-distance-value origin_source='visitor_location' postmeta='wpcf-provider-address']
[/wpv-geolocation]

Please make sure you have allowed "Know your location" in a popup when you visit above page.
You can see it here:
hidden link
username/password: xgren/111111

It seems that you have removed the distance shortcode from your own website page:
hidden link
So they can not test the problem in your website.

Since there is a JS error in your website, but I can not duplicate in my localhost and above test site:

Uncaught TypeError: $ is not a function

please check these:
1) When you open the problem URL of your own website:
hidden link
Did you see the popup message "Know your location"? and enabled it?
2) Please try as I mentioned above:
If there isn't any other compatibility problem in your website, please provide database dump file(ZIP file) of your website, I need to test and debug it in my localhost, you can put it in your own google drive disk, and share the link in below private message box, thanks
https://toolset.com/faq/provide-supporters-copy-site/