Skip Navigation

[Resolved] Toolset View – Maps

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 4 months ago.

Assisted by: Minesh.

Author
Posts
#2705836

I am trying to: I created a toolset view that gets the nearby areas. I set the Query Filter to: Distance, 0.0085mi filter radius, inside of radius, distance center is set using shortcode attribute.

Link to a page where the issue can be seen: It's a private page for the admin only. Let me know if you need an access

I expected to see/ Instead, I got:: It works when the location/address basis exist or works. But when the address basis has a wrong spelling or the address does not exist, instead of returning 0 nearby locations, it returns all.

#2705917

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL and admin access details and what address I should use that return zero items.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2707549

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I'm not sure but when I try to save the distance radius as 0.0085 it shows the following error.

Can you please tell me how even you able to save the distance radius value 0.0085?

Please check the following screenshot:
- hidden link

Or you can setup a dummny address that is not available within 1 miles and then I will check the issue further.

#2707693

I set up another view: bigger-radius-nearby-reference-checker-display that is set to 1mi. It's the same issue. Please use the same links mentioned above.

#2707772

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've added the following filter hook to "Custom Code" section offered by Toolset:
=> hidden link

function func_distance_set_nothing_for_shortcode_attribute( $view_settings, $view_id ) {
 
  if ( $view_id == 7754) {
    global $post;

       //// replace with the required address field slug
      $target_address_field = 'postcode';

     $latlong=types_render_field($target_address_field ,array('format'=>"FIELD_LATITUDE,FIELD_LONGITUDE",'item'=>$post->ID));

        if(!empty($latlong)) {
         
            $latlon =  explode(",",$latlong);
             
            $lat = $latlon[0];
            $lon = $latlon[1];
         
            $view_settings['map_distance_filter']['map_center_lat'] = $lat;
            $view_settings['map_distance_filter']['map_center_lng'] = $lon;
      }else{
            $view_settings['map_distance_filter']['map_center_lat'] = "0.0";
            $view_settings['map_distance_filter']['map_center_lng'] = "0.0";
      }
      $view_settings['map_distance_filter']['map_center_source'] = 'address';
      $view_settings['map_distance_filter']['map_distance_center'] = $shortcode_attribute_value ;

 
      
  }
  return $view_settings;
}
add_filter( 'wpv_view_settings', 'func_distance_set_nothing_for_shortcode_attribute', 5, 2 );

Can you please confirm it works as expected now.

More info:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_view_settings