Skip Navigation

[Resolved] Maps usage with a view block

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/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Waqar 2 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2678250
Screenshot-2024-01-12-at-11.06.27 PM.jpg
Screenshot 2024-01-12 at 9.44.18 PM.png
Screenshot-2024-01-12-at-9.53.15 PM.jpg

Hi, I have two questions to be solved.

1- As you can see in the attached file, there are two main columns. The left column has the list of items and the right column has the map to visualize the location of items. What I am trying to achieve is this. When I hover over any list of items, I would like some of the item information to pop up on the map with the related item.

2- I am using Divi Theme and would like to use views on the Divi Theme Builder. As we cannot include a map block in the view block, how am I supposed to have both modules communicating with each other on the Divi Theme Builder?

I tried to solve the issue with shortcodes, however, the result was not as I wanted to have.

[wpv-map-render map_id="map-5" map_height="50vw" fitbounds="off" general_zoom="4" single_zoom="15" cluster="on"][wpv-map-marker map_id="map-5" marker_id="marker-5" marker_title="" marker_field="wpcf-adress"]This is the content of the marker popup.[/wpv-map-marker]

Issues are the following :

1- Doesn't show the pin point of list view items.
2- Shows a random place on the map
3- The map is not colored

If the shortcode requires changing the id of each parameter to solve my problem, could you please be more specific about the ids of my map type and pinpoint?

I look forward to hearing back from you.

Thanks a lot!

#2678410

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

To troubleshoot and suggest the next steps, I'll need to see how these views and pages are set up in the admin area.

Can you please share the temporary admin login details and the page where this view can be seen?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2679376

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details, but I'm getting the incorrect password message.

Can you please check the username and password again?

I'm setting your next reply as private.

#2679721

Dear Waqar,

Usually, your support is amazing and on time. I am personally worried about your well-being. Hopefully, everything is going well for you.

In case you are having a difficult moment, someone else from your team can also try to provide support. It has been 10 days that I am trying to get a response for this issue to be solved. I really appreciate it if anyone could urge this problem.

Thanks again for being helpful with previous issues.

Kind regards,

Talatcan

#2679763

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Talatcan,

Thank you for your patience and concern.

Everything is fine and it is just that we had a busier than usual forum queue after the weekend.

The new access details worked and currently reviewing the existing setup and will suggest the next steps, shortly.

regards,
Waqar

#2679773

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting.

I've created a new page named 'Test page from Waqar' with a new view 'Test view from Waqar'.
( /test-page-from-waqar/ )

I purposely used the shortcodes, not the blocks for the map and the map markers, so you can use the same shortcodes while working with Divi Builder.

1. An important point is that the map's shortcode ( wpv-map-render' - https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render ) can be placed anywhere on the page, but the map marker shortcode ( 'wpv-map-marker' - https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker ) needs to be inside the loop of the view. This will work as long as both shortcodes are using the same map ID.

2. The map shortcode that I used in the right column is:


[wpv-map-render map_id="map-1" map_height="50vw"][/wpv-map-render]

3. The map marker shortcode that was used:


[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-homestay-area']This is the content of the marker popup.[/wpv-map-marker]

4. This is the format of the Toolset's 'map-focus-on-marker' feature:
( https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#map-focus-on-marker )


<a href="#" class="js-wpv-addon-maps-focus-map js-toolset-maps-hover-map-map-1-marker-marker-[wpv-post-id] js-toolset-maps-open-infowindow-map-map-1-marker-marker-[wpv-post-id]" data-map="map-1" data-marker="marker-[wpv-post-id]">view on map</a>

I included the same classes and attributes from this link, into your individual loop item's container, div with the class 'room-card' and it is working without including a separate link:


<div class="room-card js-wpv-addon-maps-focus-map js-toolset-maps-hover-map-map-1-marker-marker-[wpv-post-id] js-toolset-maps-open-infowindow-map-map-1-marker-marker-[wpv-post-id]" data-map="map-1" data-marker="marker-[wpv-post-id]">

.......

</div>

You'll notice that whenever an individual result item's card is clicked, the map is focused on its relevant marker, and the info window is also opened.

I hope this example and points will help and let me know if you have any follow-up questions.

#2680313

Hi Waqar,

Thank you so much for your support!

It worked on that particular page! I was trying to create the same process for another page but I couldn't make it work .

I need to ask two questions 🙂

1. This is the place this part into the "new view" and this view block was chosen in the Divi as in the left column.

<div class="room-card js-wpv-addon-maps-focus-map js-toolset-maps-hover-map-map-2-marker-marker-[wpv-post-id] js-toolset-maps-open-infowindow-map-map-2-marker-marker-[wpv-post-id]" data-map="map-2" data-marker="marker-[wpv-post-id]">
[wpv-map-marker map_id='map-2' marker_id='marker-[wpv-post-id]' marker_field='wpcf-homestay-area']This is the content of the marker popup.[/wpv-map-marker]
....
</div>

And updated the map marker like this: (This part was also placed on the right column in the Divi.)

[wpv-map-render map_id="map-2" map_height="50vw"][/wpv-map-render]

And still, there is no communication between the view and map sections. Where am I making the mistake here?

If you would like to take a look at the website, please go to Pages and the name of the page is [TEST] Co-living. Credentials are the same.

2. Is there any argument for changing the Map Style in the shortcode to have a colorful view? There is an argument for Type but I couldn't see any argument for map style.

#2680414

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

1. On the page that you mentioned, the map marker shortcode was referencing the custom field 'homestay-area', But for this post type, the relevant custom field is 'location-on-the-map'.

I've updated that and the map marker is showing now.

2. You can use the 'map_type' attribute to control the type of the map:
( ref: https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render )


map_type. Optional, defaults to "roadmap". Can be "roadmap", "satellite", "hybrid", or "terrain".

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