Set “Geo Location Setting” if someone doesn’t accept to share his location, show all map markers on the map

For WordPress version and Mega Locator theme

You can edit js/mega-superstorefinder.js

search for the following code:

function(error) {
                            if(self.currentState !== self.states.RUNNING) return;
                            self.rest();
                           
                            switch(error.code) {
                                case error.TIMEOUT:
                                    map.status.notify({
                                        message : 'cantLocateUser',
                                        closeable : true
                                    });
                                break;
                               
                                default:
                                    locationNotAvailable();
                                break;
                            }
                        },

And add the following lines

function(error) {
                            if(self.currentState !== self.states.RUNNING) return;
                            self.rest();
                           
                            switch(error.code) {
                                case error.TIMEOUT:
                                    map.status.notify({
                                        message : 'cantLocateUser',
                                        closeable : true
                                    });
                                // Add this code below
                                searchForStores({productsServices : ssf_default_category});
                                break;
                               
                                default:
                                    // Add this code below
                                    searchForStores({productsServices : ssf_default_category});
                                    locationNotAvailable();
                                break;
                            }
                        },

Save and upload and clear browser cache, if a user doesn’t allow to share his/her location, it will show all stores instead.

For Standalone PHP version

Edit js/super-store-finder-mobile.js or js/super-store-finder.js

Search for the following code:

gmap_location_lookup(address,distance,region);

Remove and change it to:

gmap_location_lookup(default_location,'100',''); 

You will need to set the default location from admin settings page, when a visitor block geo location, it will point to default location instead.

You can change the 100 value that will indicate showing stores within 100km distance radius from the default location.

blocked-geo-location-point-to-default-location

3+

Users who have LIKED this post:

  • Sofia Moss
  • Nadine Casmin