Skip Navigation

[Resolved] Display a map based on custom field

This support ticket is created 4 years, 7 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 2 voices.

Last updated by matthewS-9 4 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1317343

1. We have a custom Address field: map-address.
2. We use it for 2 post types: Profile and Program.
3. We show a map for Profile using the code below.

[types field='map-address'][/types]
[wpv-map-render map_id="profile-map-address"][/wpv-map-render]
[wpv-map-marker map_id='profile-map-address' marker_id='profile-marker' marker_title='Practitioner Location' marker_icon='//rjcolorado.smartstatus.com/wp-content/plugins/toolset-maps/resources/images/markers/School-2.png' marker_field='wpcf-map-address'][types field='map-address'][/types][/wpv-map-marker]

The marker is shown correctly. Please review below link.

hidden link

4. We show a map for Program type using the code below.

[types field='map-address'][/types]
[wpv-map-render map_id="program-map-address"][/wpv-map-render]
[wpv-map-marker map_id='program-map-address' marker_id='program-marker' marker_title='Program Location' marker_icon='//rjcolorado.smartstatus.com/wp-content/plugins/toolset-maps/resources/images/markers/Buildings.png' marker_field='wpcf-map-address'][types field='map-address'][/types][/wpv-map-marker]

No marker is shown. Please review below link.

hidden link

Could you please advise?

Thanks!

#1317353

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Matthew,

Thank you for getting in touch.

I see the issue on the second page you sent. From the code i'm not readily seeing any issues at all, however would you mind allowing me to have access to the site so that I can have a deeper look ?

Thanks,
Shane

#1317359

Please use the following information.

Thanks!

#1317361

It seems that the problem is automatically solved :).

#1317405

Another related issue: I followed below article to display multiple markers in a map.

https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/

However no map or any marker is shown.

Could you please review the issue at

(Admin) hidden link
and
(Front-End) hidden link

Thanks!

#1317407

The previous issue happens again at

hidden link

I feel that the component is not reliable 🙁

#1317423

We could reproduce the issue by

1) Deleting all the caches in Toolset Settings >> Maps, then

2) Visiting hidden link and hidden link .

3) At least one of them will not display the marker.

Please investigate the issue.

Thanks!

#1317431

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-08-15 at 2.50.23 PM.png
Screenshot 2019-08-15 at 2.49.48 PM.png

Hi Matthew,

So I checked this out for you and the problem seems to be your API key.

I've tried one that we use here in support and the maps show up fine. See Screenshot

However with your API key it seems that you have restricted it with a specific URL and that url is not getting validated. See Screenshot.

If you remove the domain restriction from the API key does it work then ?

Please let me know.
Thanks,
Shane

#1317449

Thanks for your help.

I think that our issue relates to some empty Address values in the list of markers.

Could you please let us know how we can check if an Address field is empty?

We tried

[wpv-conditional if="( $(wpcf-map-address) ne '' )"]
[wpv-map-marker map_id='programs-map' marker_id='program-marker' marker_field='wpcf-map-address'][/wpv-map-marker]
[/wpv-conditional]

However it seems not to work.

Thanks!

#1317451
Toolset Error.png

We also get this Toolset error. Please review the attached image.

#1317491

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Matthew,

I believe the issue goes beyond that just the empty fields, from my previous post you can see that the map markers show up fine when I changed the API Key.

What happens when an address is empty the marker will not show up at all.

To check for empty fields you can have a look at our documentation page below.
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/

For your error in your previous message could you let me know the exact steps you did to replicate this ?

Thanks,
Shane

#1317767

Thanks for your answer, Shane.

We believe that the problem is not the API key because the markers show correctly in some pages, including the page that you captured.
We did try to remove all the caches and press "Check API" key button. Everything is fine.

The markers do not show up on this specific page below.
hidden link

We tried to reduce the items and retained only 4 items. Each of them has a correct Map field value and can be shown in their individual page.

hidden link
hidden link
hidden link
hidden link

Could you please check the issue?

hidden link

hidden link
toolset/Toolset@2019.

Thanks!

#1317867

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-08-16 at 9.06.14 AM.png

HI Matthew,

For this page here hidden link

I noticed the issue was how you were placing the map on the page, as well as the marker. See Screenshot.

If you look at the screenshot you notice that you are loading the map markers before the map. Also not just loading the marker before the map but the marker is in pad-last index where no data is being passed.

To fix this I placed the map shortcode before the <wpv-loop></wpv-loop> tags and the marker shortcode inside the content template for this view so that it will load the markers onto the map.

So to set this clear it is a case where you are loading the markers before the map, when it should be loading the map before the markers.

Thanks,
Shane

#1317963

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.