Skip Navigation

[Waiting for user feedback] Showing africa map on ‘No Result found’

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.

This topic contains 3 replies, has 1 voice.

Last updated by Christopher Amirian 18 hours, 36 minutes ago.

Assisted by: Christopher Amirian.

Author
Posts
#2840088

Hi, I need your help how to change the default behaviour on map if the listing shows 'No Result found'

The map showing Africa, on the no result found hidden link

I want the map shows in Australi map instead of africa.

How to change that?

I used this code but doesn't work:

[wpv-no-items-found]
<div class="no-items">[wpml-string context="wpv-views"]No clinics found[/wpml-string]</div>
[wpv-map-marker map_id='map-3' marker_id='No result found' address='Australia' marker_icon='/wp-content/uploads/marker-empty.png'][/wpv-map-marker]
[/wpv-no-items-found]

#2840090

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. This happens when there are no markers, so the map falls back to lat 0 / lon 0 (Africa). You need to give the map a default center that is used when there are no results.

Please follow the steps below:

-In your View, make sure the map render shortcode is outside [wpv-items-found] so the map still prints when there are no results.
- Use fitbounds="off" and set Australia as default center:

[wpv-map-render map_id="map-3" fitbounds="off" general_center_lat="-25.2744" general_center_lon="133.7751" general_zoom="4"]

[wpv-map-marker] only works if the corresponding map ([wpv-map-render]) is output on the page with the same map_id, and your current map likely isn’t printed when there are “no items found”.

For more information:

https://toolset.com/forums/topic/displaying-map-with-markers-within-a-view/

Thanks.

#2840195

Hi Here is my full code, can you revise the map on the 'No result found' correctly?

I try added you code but doesn't work:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->

<div class="container cc-wrapper">
<div class="row mb-3 justify-content-md-center">
<wpv-loop>

[wpv-map-marker map_id='map-3' marker_id='marker-[wpv-post-id]' marker_icon='/wp-content/uploads/pin-color-darkblue-v2.png' marker_field='wpcf-clinic-map']

<div class="marker-wrapper mc-[wpv-post-id]">

<div class="clinic-title">[wpv-post-title]</div>

<div class="phone" style="margin-bottom: 12px;"><i class="fas fa-map-marker-alt"> <span>[types field='clinic-location'][/types]</span></div>
<div class='phone'><i class='fas fa-phone'> <span> [types field='clinic-phone'][/types]</span></div>

<div class="clinic-website">Book Now</div>

</div><!-- marker wrapper end-->

[/wpv-map-marker]

<div class="col-lg-4 col-md-6 themed-grid-col">
<div class="location-wrap molescan-[wpv-post-id]">
<div>
<div class="clinic-title">[wpv-post-title]</div>

<div class="location" style="margin-bottom: 12px;"><i class="fas fa-map-marker-alt"> <span>[types field='clinic-location'][/types]</span></div>

<div class="phone"><i class="fas fa-phone"> <span> [types field='clinic-phone'][/types]</span>
</div>

<!-- <div class="services-offered"><b>Services:</b> <span> [types field='services-offered'][/types]</span></div> -->
</div>

<div>
<div class="clinic-website">Book Now</div>

</div>
</div>
</div>

</wpv-loop>
</div>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]

[wpv-no-items-found]

<div class="no-items">[wpml-string context="wpv-views"]No clinics found[/wpml-string]</div>

[wpv-map-render map_id="map-3" fitbounds="off" general_center_lat="-25.2744" general_center_lon="133.7751" general_zoom="4"]

[/wpv-no-items-found]

[wpv-layout-end]

#2840437

Christopher Amirian
Supporter

Languages: English (English )

Hi,
I think the issue is your [wpv-map-render] is only printed inside [wpv-no-items-found].
When there are results, you output markers only, but no map container, so Toolset can’t apply your default center consistently.

Put the map render once, outside both [wpv-items-found] and [wpv-no-items-found], and keep markers inside the loop.

[wpv-layout-start]

[wpv-map-render map_id="map-3" fitbounds="off" general_center_lat="-25.2744" general_center_lon="133.7751" general_zoom="4"][/wpv-map-render]

[wpv-items-found]
<div class="container cc-wrapper">
<div class="row mb-3 justify-content-md-center">
<wpv-loop>

[wpv-map-marker map_id="map-3" marker_id="marker-[wpv-post-id]" marker_icon="/wp-content/uploads/pin-color-darkblue-v2.png" marker_field="wpcf-clinic-map"]
  ... your marker popup HTML ...
[/wpv-map-marker]

... your list/grid HTML ...

</wpv-loop>
</div>
</div>
[/wpv-items-found]

[wpv-no-items-found]
<div class="no-items">[wpml-string context="wpv-views"]No clinics found[/wpml-string]</div>
[/wpv-no-items-found]

[wpv-layout-end]

Thanks.