Fixing page number during search
This commit is contained in:
parent
7b0a0ecd16
commit
b86558764c
|
@ -207,7 +207,7 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
$country_value = get_query_var( 'location_search_country' );
|
||||
$radius_value = isset( $_REQUEST['location_search_distance'] ) ? $_REQUEST['location_search_distance'] : $radius;
|
||||
$limit_value = isset( $_REQUEST['location_search_limit'] ) ? $_REQUEST['location_search_limit'] : $limit;
|
||||
$page_value = get_query_var( 'location_search_page' );
|
||||
$page_value = $_REQUEST['location_search_page'];
|
||||
$is_sm_search = isset( $_REQUEST['location_is_search_results'] ) ? 1 : 0;
|
||||
|
||||
// Normal Field inputs
|
||||
|
@ -890,7 +890,12 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
searchData.lat = document.getElementById('location_search_default_lat').value;
|
||||
searchData.lng = document.getElementById('location_search_default_lng').value;
|
||||
searchData.limit = document.getElementById('location_search_limit').value;
|
||||
if(is_search == 1){
|
||||
searchData.page = 0;
|
||||
}
|
||||
else {
|
||||
searchData.page = document.getElementById('location_search_page').value;
|
||||
}
|
||||
searchData.searching = document.getElementById('location_is_search_results').value;
|
||||
|
||||
// Do SimpleMap Taxonomies
|
||||
|
@ -957,10 +962,6 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
searchData.limit = 0;
|
||||
}
|
||||
|
||||
if ( searchData.page == '' || searchData.page == null ) {
|
||||
searchData.page = 0;
|
||||
}
|
||||
|
||||
if ( searchData.radius == '' || searchData.radius == null ) {
|
||||
searchData.radius = 0;
|
||||
}
|
||||
|
@ -2213,7 +2214,6 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
$vars[] = 'location_search_zip';
|
||||
$vars[] = 'location_search_distance';
|
||||
$vars[] = 'location_search_limit';
|
||||
$vars[] = 'location_search_page';
|
||||
$vars[] = 'location_is_search_results';
|
||||
|
||||
return $vars;
|
||||
|
@ -2298,10 +2298,6 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
if ( '' == $atts['limit'] )
|
||||
$atts['limit'] = $options['results_limit'];
|
||||
|
||||
//Make sure we have page
|
||||
if ( '' == $atts['page'] )
|
||||
$atts['page'] = $options['results_page'];
|
||||
|
||||
// Clean search_field_cols
|
||||
if ( 0 === absint( $atts['search_form_cols'] ) )
|
||||
$atts['search_form_cols'] = $default_atts['search_form_cols'];
|
||||
|
@ -2371,7 +2367,6 @@ if ( !class_exists( 'Simple_Map' ) ) {
|
|||
'units' => '',
|
||||
'radius' => '',
|
||||
'limit' => '',
|
||||
'page' => '',
|
||||
'autoload' => '',
|
||||
'zoom_level' => '',
|
||||
'map_type' => '',
|
||||
|
|
|
@ -118,6 +118,9 @@ if ( !class_exists( 'SM_XML_Search' ) ){
|
|||
$total_locations = absint($total_locations_sql);
|
||||
$total_pages = ceil($total_locations / $limit_int); // use ceiling to round up -- 0.01 is still "1 page"
|
||||
$this_page_number = absint($input['page']);
|
||||
if($this_page_number < 1) {
|
||||
$this_page_number = 1;
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT
|
||||
|
|
Loading…
Reference in New Issue
Block a user