Skip Navigation

[Resolved] Get the map to default to a certain location when an address is not found.

This support ticket is created 3 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.

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)

This topic contains 5 replies, has 3 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1878659

Tell us what you are trying to do? Hi, I have a map in Custom Search. When nothing is found, the Google Map will display africa. So I need to know how to display some default location Charleston SC?

Is there any documentation that you are following?

https://toolset.com/forums/topic/map-in-custom-search-how-to-display-default-location-when-nothing-is-found/

I have this second one in place but it does not seem to be working. I might not be understanding exactly how to implement it. That's where you guys come in 😉

Is there a similar example that we can see?

hidden link
If you try to search a zip that does not contain one of the locations it defaults to Africa on the map.

What is the link to your site?

hidden link

#1878975

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Jessica

Can you clarify, are you using Blocks or legacy Views? The solution would be different, depending on whether you are inserting the map via the Map block that is fed by a View, or whether you are inserting it via shortcodes into the output of a View.

#1879331
Screen Shot 2020-12-17 at 9.16.51 AM.png

Not sure if this helps answer your question. This is how I'm looping the error message. This is also where in the instruction it told me to add the shortcode. The design of the page is built in DIVI. Let me know if this helps or if you need anything else.

#1879415
transparent-32x32.png
1879331-Screen_Shot_2020_12_17_at_9.16.51_AM.png

Hi, the solution suggested in the link you posted involves placing a Marker shortcode inside the wpv-no-items-found section of the View's loop. The Marker can be set to an arbitrary location, like Charleston SC. This would effectively display a map centered over a marker on Charleston, SC when no results are found. If you don't want to display a marker here, only center the map, you could upload a custom empty image icon in Toolset > Settings > Maps, and select that transparent icon instead of a standard marker icon. I'm attaching a transparent image file you could use here.

#1882745

Hey Christian,

Thank you so much for your help. I'm sorry but I'm still a little confused on how to implement your suggestion. Can you provide assistance?

#1882819
marker-tab.png
marker-icon-tab.png
icon-popup.png

Sure, I can help guide you. If you already imported the custom transparent marker icon, skip to #3.
1. Click the image name "transparent-32x32.png" in my previous reply to trigger the popup that displays the full size transparent icon. Right click the icon in the area shown in the icon-popup.png screenshot to save that image to your desktop somewhere.
2. Go to Toolset > Settings > Maps, the clck "Add Marker" to upload the transparent-32x32.png image you just downloaded.
3. In the Loop Editor of your View, click your mouse in the code editor to place the cursor just before or just after the line I outlined in red in my screenshot "1879331-Screen_Shot_2020_12_17_at_9.16.51_AM.png" in my previous reply. Then click the Fields and Views button and click Marker to begin creating a Marker shortcode.
4. In the Marker tab of the Marker popup, set the Map ID to correspond to your existing Map ID. I believe in your case that will be map-13 buty ou should confirm the correct ID in the Map shorftocde. Next set the new marker ID to be marker-no-items-found, and choose the desired centerpoint of the map by entering an address and choosing one of the suggested options. See marker-tab.png.
5. In the Marker icons tab of the popup, choose the option "No, use other icons," then select the transparent icon for this marker. See marker-icon-tab.png
6. Click "Insert shortcode" to generate and insert the marker shortcode. You should now find a wpv-map-marker shortcode inside the wpv-no-items-found shortcodes in the View's Loop Editor. When the View has no search results, this marker will be placed over the address you chose, and the map shold zoom and center over that transparent marker.

Let me know if you get stuck on one of these steps.