Update search form template.

This commit is contained in:
Hoang Huu 2019-10-10 10:41:57 +07:00
parent a701ccc5f4
commit f6a07185a8
14 changed files with 157 additions and 91 deletions

View File

@ -263,7 +263,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
$search_min_area = isset( $request['min_area'] ) ? sanitize_text_field( $request['min_area'] ) : '';
$search_max_area = isset( $request['max_area'] ) ? sanitize_text_field( $request['max_area'] ) : '';
$s = isset( $request['search_text'] ) ? sanitize_text_field( $request['search_text'] ) : null;
$per_page = isset( $request['per_page'] ) && $request['per_page'] ? $request['per_page'] : 5;
$per_page = isset( $request['per_page'] ) && $request['per_page'] ? $request['per_page'] : opalestate_options( 'search_property_per_page', 5 );
$paged = isset( $request['page'] ) && $request['page'] ? $request['page'] : 1;
if ( isset( $request['paged'] ) && intval( $request['paged'] ) > 0 ) {

View File

@ -1214,3 +1214,21 @@ function opalestate_get_property_meta_icon( $key ) {
return $classes;
}
/**
* Is enable price field in the search forms?
*
* @return bool
*/
function opalestate_is_enable_price_field() {
return 'on' == opalestate_get_option( 'opalestate_ppt_price_opt', 'on' );
}
/**
* Is enable areasize field in the search forms?
*
* @return bool
*/
function opalestate_is_enable_areasize_field() {
return 'on' == opalestate_get_option( 'opalestate_ppt_areasize_opt', 'on' );
}

View File

@ -62,13 +62,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -48,13 +48,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">

View File

@ -61,9 +61,13 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<div class="col-lg-6 col-md-6 col-sm-6">
<?php if ( opalestate_is_enable_price_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
<?php endif; ?>
</div>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>

View File

@ -71,13 +71,17 @@ $form_classes = [
<div class="opal-row">
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -67,13 +67,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -89,13 +89,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -1 +1,6 @@
<?php opalestate_property_areasize_field_template(); ?>
<?php
if ( ! opalestate_is_enable_areasize_field() ) {
return;
}
opalestate_property_areasize_field_template();

View File

@ -1,4 +1,8 @@
<?php
if ( ! opalestate_is_enable_price_field() ) {
return;
}
$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 );

View File

@ -54,13 +54,18 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/types' ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/submit-button' ); ?>

View File

@ -41,7 +41,9 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
<?php endif; ?>
<?php
if ( $display_more_options ) {

View File

@ -26,24 +26,28 @@ $form_classes = [
</div>
<div class="form-item form-item--types">
<h6> <?php esc_html_e( 'Types', 'opalestate-pro' );?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/types' , array( 'ismultiple' => true ) ); ?>
<h6> <?php esc_html_e( 'Types', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/types', [ 'ismultiple' => true ] ); ?>
</div>
<div class="form-item form-item--information">
<h6> <?php esc_html_e( 'Information', 'opalestate-pro' );?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', array( 'type' => 'input' ) ); ?>
<h6> <?php esc_html_e( 'Information', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="form-item form-item--price">
<h6> <?php esc_html_e( 'Price', 'opalestate-pro' );?></h6>
<h6> <?php esc_html_e( 'Price', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="form-item form-item--area">
<h6> <?php esc_html_e( 'Area', 'opalestate-pro' );?></h6>
<h6> <?php esc_html_e( 'Area', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php
if ( $display_more_options ) {

View File

@ -52,15 +52,19 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="form-item form-item--price">
<h6> <?php esc_html_e( 'Price', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="form-item form-item--area">
<h6> <?php esc_html_e( 'Area', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php
if ( $display_more_options ) {