To limit stores and show results on a particular location based on radius. You can perform below edits
Edit ssf-wp-xml.php file search and replace below code:
before:
if (!empty($_GET)) { $_sl = $_GET; unset($_GET['mode']); unset($_GET['lat']); unset($_GET["lng"]); unset($_GET["radius"]); unset($_GET["edit"]);} $_GET=array_filter($_GET); $ssf_wp_param_where_clause=""; if (function_exists("do_ssf_wp_hook")){ do_ssf_wp_hook("ssf_wp_xml_query"); } $query=$wpdb->get_results("SELECT * FROM ".SSF_WP_TABLE." WHERE ssf_wp_store<>'' AND ssf_wp_longitude<>'' AND ssf_wp_longitude!='0' AND ssf_wp_latitude<>'' ORDER BY ssf_wp_store ASC", ARRAY_A); $query2=$wpdb->get_results("SELECT * FROM ".SSF_WP_TAG_TABLE." WHERE ssf_wp_tag_id!=0 GROUP BY(ssf_wp_tag_slug)", ARRAY_A);
after:
$query=$query2=''; $ssf_wp_param_where_clause=""; if (function_exists("do_ssf_wp_hook")){ do_ssf_wp_hook("ssf_wp_xml_query"); } if (!empty($_POST) && isset($_POST["lng"])) { $query=$wpdb->get_results("SELECT *, ( 3959 * ACOS( COS( RADIANS(".$_POST['lat'].") ) * COS( RADIANS( ssf_wp_latitude ) ) * COS( RADIANS( ssf_wp_longitude ) - RADIANS(".$_POST['lng'].") ) + SIN( RADIANS(".$_POST['lat'].") ) * SIN( RADIANS( ssf_wp_latitude ) ) ) ) AS distance FROM ".SSF_WP_TABLE." WHERE ssf_wp_longitude!='0' HAVING distance <= ".$_POST['distance']." ORDER BY distance ASC LIMIT 0,6", ARRAY_A); }else{ $query=$wpdb->get_results("SELECT * FROM ".SSF_WP_TABLE." WHERE ssf_wp_store<>'' AND ssf_wp_longitude<>'' AND ssf_wp_longitude!='0' AND ssf_wp_latitude<>'' ORDER BY ssf_wp_store ASC", ARRAY_A); $query2=$wpdb->get_results("SELECT * FROM ".SSF_WP_TAG_TABLE." WHERE ssf_wp_tag_id!=0 GROUP BY(ssf_wp_tag_slug)", ARRAY_A); }
* Change LIMIT 0, 6 (limit to 6 results) to your desired value.
edit mega-superstorefinder.js search and replace below code
before:
if(typeof xml.data === 'undefined') { jQuery.ajax({ type: "GET", url: xml.url, dataType: "xml", success: function(data) { xml.data = data; addStores(); }, error : function() { hideMapFeedback(); showStatusFeedback(messages.cantGetStoresInfo); } }); }
after:
if(typeof xml.data === 'undefined' || typeof settings.latLng !== 'undefined') { var lat = settings.latLng.lat(); var lng = settings.latLng.lng(); var distance=settings.distance; if(ssf_matrix!='km'){ distance=distance*0.62137; } jQuery.ajax({ type: "POST", url: urls.pathToXML + xml.filename, data : { lat: lat, lng: lng, distance: distance }, dataType: "xml", success: function(data) { xml.data = data; addStores(); }, error : function() { hideMapFeedback(); showStatusFeedback(messages.cantGetStoresInfo); } }); }