Skip Navigation

[Resolved] View not displaying on map

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display a marker on a map View using the location from a related post

Solution: Use a shortcode in the View's loop to display a map marker using an address field in a related post.

This support ticket is created 2 years, 11 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 1.20 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#2039565

Tell us what you are trying to do?
I want to show a list of items from a view on a map. When I look at a single item, it appears on the map, however when I want to display multiple items from a 'search view' the map is empty.

Is there any documentation that you are following?
I followed the steps here https://toolset.com/course-lesson/displaying-a-list-of-posts-on-a-map/#displaying-multiple-markers-that-appear-on-the-same-location
In the view block I selected partner-address, which is powering the single item view and working fine. But it's the full map that isn't loading.

Is there a similar example that we can see?

What is the link to your site?
hidden link
This is where it is supposed to show the list of items in a view and on a map. The list is showing, but the markers are not appearing on the map.

#2039969

Hello, I can help troubleshoot the map issue. Can you try the following troubleshooting steps and let me know the results?
- Go to Toolset > Settings > Maps and click "Check API". This will verify if the required APIs are active in the Google Maps / Azure Maps console, and your API key is registered successfully. If single maps are working correctly this is probably already set up correctly, but it's best to confirm here anyway.
- Edit the Content Template where you have created this View and map combination. In the View results, note the first post that is included in the list. Edit that post and confirm it has an address populated in the partner-address custom field. If not, add one temporarily. Sometimes when the first result in the View does not contain the appropriate information, the dynamic sources system has trouble extrapolating that custom field setting to other posts, and giving the first post a temporary value will force that to work correctly. Update the post, then refresh the Content Template editor page. In the marker settings, choose a different value like "Address" temporarily, then choose "View block" again and select the correct View block and field settings to reset the dynamic source for this marker
- Retest the map on the front-end of the site, and verify it is working as expected
- If not, try temporarily disabling all 3rd-party plugins except Toolset Types, Toolset Blocks (or Views if your site uses Views) and Toolset Maps
- Deactivate all custom code snippets in Toolset > Settings > Custom Code tab
- Activate a default theme like Twenty Twenty One temporarily
- Test the map again
- If the problem is resolved, reactivate your theme, other plugins, and custom code snippets one by one, testing each time until the problem returns
- If the problem is not resolved, I may need to take a closer look.

Please let me know the results of these troubleshooting steps and we can go from there.

#2040639

Thanks. I did all of these things and it's still not loading a map with all entries on the view - I can only get a single address on a map for a single post page.

Any of tips?

#2041505

Not sure what the problem could be, but I will be glad to log in and take a closer look in wp-admin. Please provide login credentials for the staging site in the private reply fields here.

#2049409

Sorry, I get "Oops, that's not the right password. Please try again!" when I try to log in with these credentials. Can you double check for me? I'm trying to log in at the URL you provided in your private reply. If I've misunderstood, please provide a different URL or different credentials for me to check.

#2054527

Okay I was able to log in using these credentials, thank you for the update. If I understand correctly, you would like to show a list of Products in the custom search View results. In the map above the Products results, you would like to show markers corresponding to each Product in the results, but the address field holding the location for the marker - with the field slug "partner-address" - is stored in a related Partners&Venues post. The relationship between Products and Partners&Venues is a one-to-many relationship called "Film Screening Venues" where the parent is Partners&Venues and the child is Products. So to sum up, the address of the marker for each Product is contained in its parent Partners&Venues post custom field "partner-address".

For example, considering this Product "The 8th x Aberystwyth Arts Centre":
hidden link
The Product post is editable here in wp-admin:
hidden link
The related parent Partners&Venue is "Aberystwyth Arts Centre":
hidden link
That Partners&Venues post is editable here in wp-admin:
hidden link
The partner-address field value in the Partners&Venues post is "Aberystwyth Arts Centre, Aberystwyth, Ceredigion SY23 3DE, UK", so the marker for The 8th x Aberystwyth Arts Centre should be shown there in the results map. If I've misunderstood any of that so far, please let me know.

I'm a bit unclear about how this page is set up. I can see a View "List of Screening Venues (this film)" is included at the top of the page, but that View produces no results and no filters are displayed. Maybe you're still working on this section? As of right now it seems redundant, so the solution I'm talking about below should all be implemented in the Film Screenings View.

It looks like you've tried to configure the map block to display markers coming from one of the Product Views. The problem is that the address field you want to use for the marker is not stored in Product posts, so the marker is not displayed as expected. If you had the ability to choose a field from a related post for the marker's dynamic source, that would help here, but this feature is not currently available. The marker dynamic sources feature will only allow access to the fields directly in the result posts. What you need here is the ability to access address field values in related posts, and in this case a marker shortcode workaround is required. Unfortunately you will not be able to create your marker using the Toolset Map Blocks design features, but I can help you set up the marker using our shortcode system instead.

- Edit this Page and select the Map block. I can see there are already two markers configured here. Unless you are using this View in other pages on the site, you can delete the existing marker settings as they will be redundant. The new marker we create will exist a shortcode, not as a marker panel here in the sidebar.

- Next we will add a marker to each item in the main search results View by adding a map marker shortcode. Edit the loop in the results and insert a custom HTML block anywhere inside the View Loop Block. The marker shortcode will not appear in the results list, it will only register a marker in the map for each item in the results. Add the following map marker shortcode in the custom HTML block:

[wpv-map-marker map_id='map-7' marker_id='marker-partner-address' marker_field='wpcf-partner-address' item='@film-venue-platform.parent']
  Example: [wpv-post-link] - This is where you can add popup content using HTML and our shortcodes. For complex markup or Block Editor editing capability, create this content in a separate Content Template and insert that template here using the wpv-post-body shortcode.
[/wpv-map-marker]

- You can edit the content in between the marker shortcode tags to adjust the contents of the marker popup. If you want to change the marker_id attribute, you should choose something unique so that this marker's id does not conflict with any other marker IDs applied to the same map. The two existing markers are currently configured as marker-7 and marker-10, so I would avoid those two IDs unless you plan to delete those existing markers from the map block.

- You should not change the other wpv-map-marker shortcode attributes unless you make some major changes to map IDs, custom address fields or their slugs, or to the post relationships involved.

- You can learn more about the map marker shortcode options in our docs here:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

- Content template shortcode wpv-post-body:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

Let me know if you have questions about this, or if you have trouble implementing the solution I've described. I can offer more direct guidance as needed.

#2055947

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.