Tell us what you are trying to do?
I have two issues. First is speed:
Please see our previous tickets involving map speed issues...
With Toolset support, I was able to build a map that functions exactly as I need it to.
This map uses a users IP address to generate a shortcode which informs a view, and sorts by distance. Then if the user searches, after ajax runs a url parameter is used to inform a view for results. When there are no results in either, the results output results outside the radius of the location. It's not nearly so straight forward.
My concern from the very beginning has been speed. Every Toolset Map build I've done so far has been a significant drag on our performance scores.
This latest map (one intended to speed up the page load) accounts for up to 8 seconds of load time. That is completely unacceptable.
In a previous ticket W3 Total Cache was recommended. This didn't help, as the speed improvement was only granted on a second viewing and the plugin actually caused more issues elsewhere, eliminating any net value.
Is there any documentation that you are following?
I have read numerous posts from other users citing speed issues with maps that weren't resolved.
I have worked with Toolset support to implement changes to improve speed. A few of those attempts, such as deferring the view rendering to occur via ajax, were determined to be impossible with Toolset Views. The others seemed promising, but haven't delivered us positive results.
Right now the view structure for the 'buy local map' is:
1. Master View
- Renders search controls, primary map, and html structure for controls, map and results
This view is set to render no results with PHP for $query_args['post__in'] = array(0);, and in the no results section we have conditionals to handle which nested view should be delivered.
2. Shortcode Attribute Results View - INSIDE Radius - Nested in "1. Master View"
- Renders results based on a shortcode attribute which is a variable generated by a very fast and simple IP API JSON service.
- This outputs 50 closest results within a 60 radius which is sorted by distance.
3. URL Parameter Results View - INSIDE Radius - Nested in "1. Master View"
- Renders results based on the URL Parameter which is generated when a user clicks 'use my location' or searches an address. This also renders if a user is coming from an IP address that is associated with a mobile service provider, again, using the very fast and simple IP API JSON service to make that determination.
- This outputs 50 closest results within a 60 radius which is sorted by distance.
4. Shortcode Attribute Results View - OUTSIDE Radius - Nested in "2. Shortcode Attribute Results View - INSIDE Radius"
- Renders results based on a shortcode attribute which is a variable generated by a very fast and simple IP API JSON service.
- When INSIDE Radius has no results within 60 miles of the location, this outputs 50 closest results starting at 1 mile outside the radius which is sorted by distance.
5. URL Parameter Results View - OUTSIDE Radius - Nested in "3. URL Parameter Results View - INSIDE Radius"
- Renders results based on the URL Parameter which is generated when a user clicks 'use my location' or searches an address.
- When INSIDE Radius has no results within 60 miles of the location, this outputs 50 closest results starting at 1 mile outside the radius which is sorted by distance.
The reason this is so complicated is because a single view apparently doesn't have a simple way to switch from a shortcode attribute as the query source to a URL parameter as the query source. Additionally, a single view's only way for managing what to do when a location queried has no results within a radius is to default to a second view. That being said, the average user should only ever have 2 to 3 views in this structure rendering. In my testing, where only two views render, the "Reduce initial server response time" is consistently between 8 and 9 seconds (without these views this doesn't drag doesn't even register). Two views, 50 results, 8-9 seconds. The total difference between the page load with and without this map view are as follows:
With the "1. Master View" (and thus "2. Shortcode Attribute Results View - INSIDE Radius"):
Performance Score - 30
First Contentful Paint - 3.8s
Speed Index - 18.4s
Largest Contentful Paint - 8.7s
Time to Interactive - 11.0s
Total Blocking Time - 490ms
Cumulative Layout Shift - 0.296
Without the Master View:
Performance Score - 48
First Contentful Paint - 3.7s
Speed Index - 4.4s
Largest Contentful Paint - 8.3s
Time to Interactive - 8.6s
Total Blocking Time - 360ms
Cumulative Layout Shift - 0.291
I'll add that just counting the seconds out loud, I can confirm a difference of 8 full seconds.
Outside of the slow queries, I've found that having my custom php for sorting by distance on a shortcode attribute view slows things down: accounting for about 4 of the 8 to 9 seconds. The custom php to kill the query (mentioned above) is probably having a similar effect, but I don't know how to rework what I have without that php. It seems these will never be added as features on Views.
Okay, the second issue...
[toolset-maps-distance-value location='[users_ip_location]' target_source='postmeta' postmeta='wpcf-dealer-address' postmeta_id='[wpv-post-id]' decimals='2']
...and...[toolset-maps-distance-value origin_source='visitor_location' postmeta='wpcf-dealer-address']
These shortcodes only work in the first few iterations of a loop. Sometimes if you refresh the page or run ajax you can get all the iterations. But I've never seen all iterations show up on the first load.
What is the link to your site?
hidden link - click buy local
I'll take whoever is assigned, but I'd prefer someone in my timezone (central US) as it's always easier with the schedule.