Fix price thousand unit.

This commit is contained in:
Hoang Huu 2019-10-12 10:48:34 +07:00
parent 174811f428
commit 095a398559
3 changed files with 23 additions and 18 deletions

View File

@ -474,10 +474,11 @@ jQuery( document ).ready( function ( $ ) {
var imax = $( '.slide-ranger-max-input', this ).val(); var imax = $( '.slide-ranger-max-input', this ).val();
var slider = $( '.slide-ranger-bar', this ).get( 0 ); var slider = $( '.slide-ranger-bar', this ).get( 0 );
var unit_pos = $( this ).data( 'unitpos' ); var unit_pos = $( this ).data( 'unitpos' );
var unit_thousand = $( this ).data( 'thousand' );
var config_format = { var config_format = {
decimals: decimals, decimals: decimals,
thousand: ',', thousand: unit_thousand,
}; };
if ( unit_pos == 'prefix' ) { if ( unit_pos == 'prefix' ) {

View File

@ -75,6 +75,7 @@ function opalestate_property_areasize_field_template( $template = '' ) {
'ranger_max' => opalestate_options( 'search_max_area', 1000 ), 'ranger_max' => opalestate_options( 'search_max_area', 1000 ),
'input_min' => $search_min, 'input_min' => $search_min,
'input_max' => $search_max, 'input_max' => $search_max,
'unit_thousand' => apply_filters( 'opalestate_areasize_unit_thousand', ',' ),
]; ];
opalesate_property_slide_ranger_template( esc_html__( 'Area', 'opalestate-pro' ), $data ); opalesate_property_slide_ranger_template( esc_html__( 'Area', 'opalestate-pro' ), $data );
@ -82,7 +83,7 @@ function opalestate_property_areasize_field_template( $template = '' ) {
return; 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. * Render slider ranger template.
@ -100,6 +101,7 @@ function opalesate_property_slide_ranger_template( $label, $data ) {
'input_min' => 0, 'input_min' => 0,
'input_max' => 1000, 'input_max' => 1000,
'unit_position' => 'postfix', 'unit_position' => 'postfix',
'unit_thousand' => ',',
'mode' => 2, 'mode' => 2,
'start' => '', 'start' => '',
]; ];
@ -109,7 +111,8 @@ function opalesate_property_slide_ranger_template( $label, $data ) {
extract( $data ); extract( $data );
?> ?>
<label class="opalestate-label opalestate-label--<?php echo sanitize_title( $label ); ?>"><?php echo esc_html( $label ); ?></label> <label class="opalestate-label opalestate-label--<?php echo sanitize_title( $label ); ?>"><?php echo esc_html( $label ); ?></label>
<div class="opal-slide-ranger" data-unit="<?php echo $unit; ?>" data-unitpos="<?php echo $unit_position ?>" data-decimals="<?php echo $decimals; ?>"> <div class="opal-slide-ranger" data-unit="<?php echo $unit; ?>" data-unitpos="<?php echo $unit_position ?>" data-decimals="<?php echo $decimals; ?>" data-thousand="<?php echo esc_attr(
$unit_thousand ); ?>">
<label class="slide-ranger-label"> <label class="slide-ranger-label">
<span class="slide-ranger-min-label"></span> <span class="slide-ranger-min-label"></span>
<?php echo ( $mode == 2 ) ? '<i>-</i>' : ''; ?> <?php echo ( $mode == 2 ) ? '<i>-</i>' : ''; ?>

View File

@ -3,8 +3,8 @@ if ( ! opalestate_is_enable_price_field() ) {
return; return;
} }
$search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ): opalestate_options( 'search_min_price', 0 ); $search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ) : opalestate_options( 'search_min_price', 0 );
$search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ): opalestate_options( 'search_max_price', 10000000 ); $search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ) : opalestate_options( 'search_max_price', 10000000 );
$data = [ $data = [
'id' => 'price', 'id' => 'price',
@ -14,6 +14,7 @@ $data = [
'ranger_max' => opalestate_options( 'search_max_price', 10000000 ), 'ranger_max' => opalestate_options( 'search_max_price', 10000000 ),
'input_min' => $search_min_price, 'input_min' => $search_min_price,
'input_max' => $search_max_price, 'input_max' => $search_max_price,
'unit_thousand' => opalestate_options( 'thousands_separator', ',' ),
]; ];
if ( opalestate_options( 'currency_position', 'before' ) == 'before' ) { if ( opalestate_options( 'currency_position', 'before' ) == 'before' ) {