Skip Navigation

[Closed] Distance value not appearing for all results in a View upon page load

This support ticket is created 3 years, 5 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 1 reply, has 2 voices.

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

Assisted by: Christian Cox.

Author
Posts
#2111477

Tell us what you are trying to do?
I have two issues. First is speed (see https://toolset.com/forums/topic/issues-with-map-loading-speed-and-issues-with-distance-value/).

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.

---- Reference from previous ticket ----

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.

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.

#2111563

Okay I'll take a look. When I test this page, I get two results in the Buy Local map, and both have distance value calculated and displayed correctly. Can you recommend a way to test this to produce more results to see the problem? Should I hard-code some location in the shortcode attribute?

Private reply fields available here in case you respond to this ticket before the performance ticket.

The topic ‘[Closed] Distance value not appearing for all results in a View upon page load’ is closed to new replies.