From 095a398559f4d904517a3b06c78ee694a5b9dd99 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Sat, 12 Oct 2019 10:48:34 +0700 Subject: [PATCH] Fix price thousand unit. --- assets/js/opalestate.js | 3 ++- inc/function-search-fields.php | 19 +++++++++++-------- templates/search-box/fields/price.php | 19 ++++++++++--------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/assets/js/opalestate.js b/assets/js/opalestate.js index c2ca71f3..2b0a7761 100755 --- a/assets/js/opalestate.js +++ b/assets/js/opalestate.js @@ -474,10 +474,11 @@ jQuery( document ).ready( function ( $ ) { var imax = $( '.slide-ranger-max-input', this ).val(); var slider = $( '.slide-ranger-bar', this ).get( 0 ); var unit_pos = $( this ).data( 'unitpos' ); + var unit_thousand = $( this ).data( 'thousand' ); var config_format = { decimals: decimals, - thousand: ',', + thousand: unit_thousand, }; if ( unit_pos == 'prefix' ) { diff --git a/inc/function-search-fields.php b/inc/function-search-fields.php index 4bffe8af..11324c54 100755 --- a/inc/function-search-fields.php +++ b/inc/function-search-fields.php @@ -69,12 +69,13 @@ function opalestate_property_areasize_field_template( $template = '' ) { $search_max = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : opalestate_options( 'search_max_area', 1000 ); $data = [ - 'id' => 'area', - 'unit' => opalestate_options( 'measurement_unit', 'sq ft' ) . ' ', - 'ranger_min' => opalestate_options( 'search_min_area', 0 ), - 'ranger_max' => opalestate_options( 'search_max_area', 1000 ), - 'input_min' => $search_min, - 'input_max' => $search_max, + 'id' => 'area', + 'unit' => opalestate_options( 'measurement_unit', 'sq ft' ) . ' ', + 'ranger_min' => opalestate_options( 'search_min_area', 0 ), + 'ranger_max' => opalestate_options( 'search_max_area', 1000 ), + 'input_min' => $search_min, + 'input_max' => $search_max, + 'unit_thousand' => apply_filters( 'opalestate_areasize_unit_thousand', ',' ), ]; opalesate_property_slide_ranger_template( esc_html__( 'Area', 'opalestate-pro' ), $data ); @@ -82,7 +83,7 @@ function opalestate_property_areasize_field_template( $template = '' ) { return; } -add_filter( "opalestate_property_areasize_field_template", 'opalestate_property_areasize_field_template' ); +add_filter( 'opalestate_property_areasize_field_template', 'opalestate_property_areasize_field_template' ); /** * Render slider ranger template. @@ -100,6 +101,7 @@ function opalesate_property_slide_ranger_template( $label, $data ) { 'input_min' => 0, 'input_max' => 1000, 'unit_position' => 'postfix', + 'unit_thousand' => ',', 'mode' => 2, 'start' => '', ]; @@ -109,7 +111,8 @@ function opalesate_property_slide_ranger_template( $label, $data ) { extract( $data ); ?> -
+