How to disable user geolocation?

New home Forums Basic Version How to disable user geolocation?

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #76089
    kanstantsin.hrytsuk
    Participant

    Hello,
    I use Store Locator and this feature “https://docs.wpgmaps.com/enabling-distance-features” but when this feature is enabled, users need to confirm the use of geolocation

    So, how can I disable the geolocation confirmation popup and use the distance feature for the store locator?

    FYI:
    These features are disabled:
    – “Show user’s location”
    – “Automatically pan to users location?”

    Attachments:
    You must be logged in to view attached files.
    #76115
    Matthew
    Moderator

    Hi there,

    Thank you for your response and time on this, I really appreciate it!

    Please may I also ask if you may ensure that your Marker Listing “Order markers by” setting is not set to “Distance” as this will cause the user location prompt to be appear.

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #76128
    kanstantsin.hrytsuk
    Participant

    Hello,
    Yes, the “Order markers by” setting is set to “Distance”, because we need to sort all the items in the list of markers when the user uses the store locator
    How can I use the “Order markers by” -> “Distance” and disabled confirm the use of geolocation ?

    #76144
    Matthew
    Moderator

    Hi there,

    Thank you for your response and time on this, I really appreciate it!

    Thank you for the confirmation, you may be able to achieve this by using some custom JS code below:

    jQuery(function($){
    	WPGMZA.ProMap.prototype.onMarkersPlaced = function(event)
    	{
    		var self = this;
    		
    		// NB: Marker listing. We delay this til here because the marker gallery will need to fetch marker data from here
    		// A good alternative to this would be to transmit the marker data in a data- attribute
    		
    		var jumpToNearestMarker = (WPGMZA.is_admin == 0 && self.settings.jump_to_nearest_marker_on_initialization == 1);
    		
    		if(self.settings.fit_maps_bounds_to_markers && self.markers.length > 0){
    			self.fitBoundsToMarkers();
    		}
    
    		self.initMarkerListing();
    
    		// Clustering
    		// TODO: Move to Gold with a listener
    		if(this.settings.mass_marker_support == 1 && WPGMZA.MarkerClusterer)
    		{
    			var options = {};
    			
    			if(WPGMZA.settings.wpgmza_cluster_advanced_enabled)
    			{
    				var styles = [];
    				
    				options.gridSize		= parseInt( WPGMZA.settings.wpgmza_cluster_grid_size );
    				options.maxZoom			= parseInt( WPGMZA.settings.wpgmza_cluster_max_zoom );
    				options.minClusterSize	= parseInt( WPGMZA.settings.wpgmza_cluster_min_cluster_size );
    				options.zoomOnClick		= WPGMZA.settings.wpgmza_cluster_zoom_click ? true : false;
    				
    				for(var i = 1; i <= 5; i++) {
    					level = {};
    					level.url		= WPGMZA.settings["clusterLevel" + i].replace(/%2F/g, "/");
    					level.width		= parseInt( WPGMZA.settings["clusterLevel" + i + "Width"] );
    					level.height	= parseInt( WPGMZA.settings["clusterLevel" + i + "Height"] );
    					
    					level.textColor	= WPGMZA.settings.wpgmza_cluster_font_color;
    					level.textSize	= parseInt( WPGMZA.settings.wpgmza_cluster_font_size );
    					
    					styles.push(level);
    				}
    				
    				options.styles = styles;
    			}
    			
    			
    			this.markerClusterer = new WPGMZA.MarkerClusterer(this, null, options);
    			this.markerClusterer.addMarkers(this.markers);
    		}
    	}
    })

    Please may you copy, paste and save the above code into the “Custom JS” setting block (Maps -> Settings -> Custom Scripts/Advanced Settings)?

    Once this has been done, please may you clear your browser cache and confirm if this helps?

    Kindest Regards,
    Matthew

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.