Skip Navigation

[Resolved] I was trying to setup distance filter on a view

This support ticket is created 4 years, 8 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 10 replies, has 2 voices.

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

Assisted by: Luo Yang.

Author
Posts
#1611573

Hello
I was able to show the map using views.
With this code
[wpv-view name="list-of-apartments" toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-map-apartments' postmeta_id='$current_page']
I was trying to filter a view but it doesn't work.
Following this info https://toolset.com/forums/topic/show-posts-close-to-the-current-one/ same problem
Can you help ?
KR
Stefano

#1611717

Dear Stefano,

I assume we are talking about a custom address field "map-apartments", if it is, please try to modify the view's shortcode as below:

[wpv-view name="list-of-apartments" mapcenter="[types field='map-apartments' output='raw'][/types]" cached="off"]

And test again

#1615905

Hi Luo
It doesn't work for me, still show all the map.
When I select Distance center is set using a fixed location is working fine, but when I select Distance center is set using shortcode attribute (mapcenter) no.

#1616153
mapcenter.JPG

Please check this:
Edit the post view "list-of-apartments", in section "Query Filter", find and edit the distance filter, make sure you are using below option:

Distance center is set using shortcode attribute: mapcenter

See screenshot: mapcenter.JPG

#1616507

Yes, I'm using that option from the beginning, but it doesn't work

#1619293

The problem you mentioned above is abnormal, please check these:
1) 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

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

3) 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/

#1629719

The database dump file you provided above is not valid, it links to a 404 page, it might be a file size problem.

You can put the duplicator package file in your own google drive disk, and share the link only. Private message box enabled again. thanks

#1631457

Thanks for the details, I am downloading the files, will update here if there is any finds.

#1631599

I can install the package file, here is what I found:
1) There isn't plugins folder in the duplicator package you provided above, so I have installed the Toolset Blocks + Types + Maps plugins

2) Edit the post "apartment test", I don't see how and where do you setup the map shortcode, and your custom address field is using slug "map-apartments", it is not "Map-apartments", the custom field slug should be in lowercase, so you can display the address value with below shortcode:
[types field='map-apartments' output='raw'][/types]
And display the view shortcode like this:
[wpv-view name="list-of-apartments" mapcenter="[types field='map-apartments' output='raw'][/types]" cached="off"]

In my test, it returns result: No item found.

And if I change the distance filter range to 100 km, then it returns all other 4 apartment post links.

#1632431

Hi Luo

Thank you for your help.
IMO there are few problems in Toolset, the main problem with maps is the cache.
If I upload a new item, the map is displayed correctly, but if I visit another item, the results of the map do not change, if I add a new one, the problem is solved again.
Do you have a similar experience ? Is this normal ?
KR
Stefano

#1632687

It works fine in my localhost, how do you display the map shortcode in the "another item"?
Please check this:
In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020.