Hi there,
On a new site we've been working on for a while, we've noticed something and thought we would ask...
See this page with it's map on the right:
hidden link
Works just as we hope however, we have pagination enabled and this shows a max of 16 properties before moving onto the next page. No issue.
However is there a way the map can show all the properties, not just the ones displayed on the visible grid?
We really wished the map to show all properties, this to give greater search options rather than just what is showing in the grid.
On face value, it's showing far less that what we have available for that specific area.
This is the code we are using for the map:
[wpv-map-render map_id="map-family" map_height="93vh" fitbounds="off" cluster="on" street_view_control="off" general_zoom="10" general_center_lat="54.34" general_center_lon="-3.023"][/wpv-map-render]
Many thanks, Pete
Hi Pete,
Thank you for contacting us and I'd be happy to assist.
The way map and map marker feature work, it is dependant on the locations coordinates coming from the source items.
When a post view is showing only a limited number of results on each page, the locations coordinates available are also limited to only those source items.
A workaround, in this case, can be to create a duplicate of your actual view and set the duplicate view to have no pagination.
( i.e. show all results on a single page )
The map and the map markers can be shown through this new view, removing everything else from the view's output.
And the visible grid below will keep showing paginated results, through the original view.
( you'll remove the map and map marker shortcodes from the original view to avoid repetition )
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
Ok I'll give this a try however I'm going to end up with a ton of views if i have to duplicate every view that uses a map, we currently have 18 already and intend to add more, so we'll end up with double this amount.
This wont in anyway impact on page speed etc will it?
Wish there was another way of doing this, feels a very messy way of going about things.
Can;t I create one content template and this is added to every view?
Many thanks.
Hi again,
Ok tried this and can't get this to work at all. May need more guidance on this one please?
Again, this just seems a messy way of doing this.
Hi Pete,
Unfortunately, I can't think of any other workaround in this case, since we'll need two separate loops on the page, for the non-paginated map markers and the paginated posts grid.
If it helps, you won't have to create a duplicate of every view. Once you'll have one view without any pagination and with the map and map marker shortcodes, it can be reused on pages with the views with the same post type and query filters.
( i.e. where the result criteria are the same, but only the presentation is different )
You're welcome to submit a feature request for it at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
If you've tried to use this for a specific page/view and it isn't working, please share temporary admin login details and link to that page and I'll troubleshoot it accordingly.
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
regards,
Waqar
Hi Pete,
Thank you for sharing the admin access.
I just wanted to let you know that I'm currently reviewing how the map and views are being used and will suggest the best way forward accordingly.
Thank you for your patience.
regards,
Waqar
Hi Waqar,
Thank you. I did try again this morning to do as you suggested. I can't make a View with nothing else in it other than a map...it just throws up an error.
I understand what you're suggesting however I just can't seem to get it working 🙂
Waqar,
Is there any thoughts ref this please? The site is just sat there waiting to go live.
If you could let me know I would be grateful.
Thank you, Pete
Hi Pete,
Thank you for waiting and sorry about the delay in getting back on this.
Based on what we've discussed, I've created an example page named "Test page from TS Support".
( hidden link )
Here are the points to note:
1. The page uses two views:
a). Destination Lake District - results
This is a duplicate of your view "Destination Lake District" ( no change was made to the original view).
Only changes that are made to this duplicate view are the removal of map marker shortcode and then setting the search results to update through page reload and not through AJAX.
( this is to ensure that the front-end search filters from the search form are also applied to the map results in the second view )
b). Destination Lake District - map
This is also a duplicate of your view "Destination Lake District".
The changes that are made to this duplicate view are the removal of the pagination, extra HTML, CSS, and JS code and inclusion of the map's shortcode.
As a result, when both these views will be used on a page, the first one will show grid results with pagination and the second one will show map and the markers for all results without the pagination.
I hope this helps.
regards,
Waqar
Hi there Waqar,
Thank you for looking into this for me, appreciate it.
Great it works and I see and understand what you have done with the view for this map...I was over complicating things when attempting this.
All great however can I ask further?
You have created two new 'views'...
Destination Lake District - map
Destination Lake District - results
For Destination Lake District - results
I see you have changed the Custom Search Settings, is this ok to apply these settings to all my other views?
This based on the fact you changed nothing else?
Yes or no....I need to be clear on this as I don't want to mess up the site 🙂
For Destination Lake District - map
How do I use this one map to replace the ones I already have?
I'm using the below shortcode in the Elementor builder and unsure what to do to make this new map work?
[wpv-map-render map_id="map-family" map_height="93vh" fitbounds="off" cluster="on" street_view_control="off" general_zoom="10" general_center_lat="54.34" general_center_lon="-3.023"][/wpv-map-render]
Hi Pete,
Thanks for the update and glad that you like the results.
> For Destination Lake District - results
> I see you have changed the Custom Search Settings, is this ok to
> apply these settings to all my other views?
> This based on the fact you changed nothing else?
- Yes, I can confirm that the only changes made in the "Destination Lake District - results" view ( with respect to the original "Destination Lake District" view ) were in the "Custom Search Settings" section and the loop item template section (to remove the map marker shortcodes).
> For Destination Lake District - map
> How do I use this one map to replace the ones I already have?
> I'm using the below shortcode in the Elementor builder and
> unsure what to do to make this new map work?
- To keep things simple, I placed the same map shortcode inside the loop editor of this view and then placed both views on my example page.
( screenshot: hidden link )
But you can remove that map shortcode from inside the map view and keep on adding it directly in the Elementor builder's template as you've done on the existing lake district page.
hidden link
( screenshot: hidden link )
To sum this up, a page will need to include these three components, irrespective of the order or the layout:
1. Map shortcode
2. View with a map marker shortcode for all (un-paginated) results.
3. View with a grid of paginated results.
regards,
Waqar
Hi Waqar,
Thank you for that. Ok, after a little time I kind of worked out how to apply this to my existing Views and pages.
Works great on this page:
hidden link
However, remember me saying further up, we couldn't create a new map view for every view we have, this because there will be way to much stuff going on?
Well see this page:
hidden link
It has exactly the same pins and locations as the one above, and it shouldn't.
The pins have to be relevant to the grid they are showing. I guess it's to do with...
<wpv-loop>
[wpv-post-body view_template="loop-item-in-destination-lake-district-map"]
</wpv-loop>
This from your Map View and specifies destination-lake-district
We have about 20 destinations, this my worry all along, we can't have a map view for every area and you said we'd only need one map.
I guess I'm doing something wrong however can't work this out.
Hi Pete,
Yes, I mentioned that you'll be able to use the same map view for multiple result views, but that would work only when the query or the overall post criteria is the same.
( https://toolset.com/forums/topic/show-all-properties-on-map/#post-1592755 )
"If it helps, you won't have to create a duplicate of every view. Once you'll have one view without any pagination and with the map and map marker shortcodes, it can be reused on pages with the views with the same post type and query filters.
( i.e. where the result criteria are the same, but only the presentation is different )"
And if you'll check "Destination Lake District" view it is set to get posts with the area "Lake District" and the "Destination Cumbria" view is set to get posts with the area "Cumbria".
If this is the only difference between these two views, then you can make this area filter dynamic, by setting the area taxonomy filter to use the target term's slug through the shortcode parameter "wpv-area".
Screenshot: hidden link
And after that, you can pass on the shortcode attribute and the target term's slug value in the view's widget in the template, like this "wpv-area|lake-district".
Screenshot: hidden link
This approach would allow you to use the same view to show results from the different areas, by only changing the area term's slug in the passed attribute.
Again, for this very specific requirement of paginated results and non-paginated map markers, you can either make your views query as dynamic as possible, or if it sounds too complicated or where this is unavoidable, use a separate map view.
I hope this makes sense.
regards,
Waqar
Hi Waqar,
This is getting soooo complicated. I guess I understand where you're coming from.
Trying out what you suggesting and hitting this issue?
Hi Pete,
The "wpv-area" seems to be a reserved word, but you should still be able to use "wpvarea" or "area".
regards,
Waqar