Remove required price
This commit is contained in:
parent
f171fe17f7
commit
23b5505a42
@ -366,7 +366,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
[
|
[
|
||||||
'taxonomy' => 'opalestate_amenities',
|
'taxonomy' => 'opalestate_amenities',
|
||||||
'field' => 'slug',
|
'field' => 'slug',
|
||||||
'terms' => sanitize_text_field( $request['amenities'] ),
|
'terms' => ( $request['amenities'] ),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,29 +376,46 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$args['meta_query'] = [ 'relation' => 'AND' ];
|
$args['meta_query'] = [ 'relation' => 'AND' ];
|
||||||
if ( isset( $request['info'] ) && is_array( $request['info'] ) ) {
|
|
||||||
$metaquery = [];
|
if ( isset( $request['info'] ) ) {
|
||||||
foreach ( $request['info'] as $key => $value ) {
|
$info_array = [];
|
||||||
if ( trim( $value ) ) {
|
if ( is_array( $request['info'] ) ) {
|
||||||
if ( is_numeric( trim( $value ) ) ) {
|
$info_array = $request['info'];
|
||||||
$fieldquery = [
|
} elseif ( is_string( $request['info'] ) ) {
|
||||||
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
|
$info = $request['info'];
|
||||||
'value' => sanitize_text_field( trim( $value ) ),
|
$array = json_decode($info);
|
||||||
'compare' => apply_filters( 'opalestate_info_numeric_compare', '>=' ),
|
$array = json_decode(json_encode($array), true);
|
||||||
'type' => 'NUMERIC',
|
|
||||||
];
|
if ( is_array( $array ) ) {
|
||||||
} else {
|
$info_array = $array;
|
||||||
$fieldquery = [
|
|
||||||
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
|
|
||||||
'value' => sanitize_text_field( trim( $value ) ),
|
|
||||||
'compare' => 'LIKE',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$sarg = apply_filters( 'opalestate_search_field_query_' . $key, $fieldquery );
|
|
||||||
$metaquery[] = $sarg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$args['meta_query'] = array_merge( $args['meta_query'], $metaquery );
|
|
||||||
|
if ( $info_array && ! empty($info_array) ) {
|
||||||
|
$metaquery = [];
|
||||||
|
foreach ( $info_array as $key => $value ) {
|
||||||
|
if ( trim( $value ) ) {
|
||||||
|
if ( is_numeric( trim( $value ) ) ) {
|
||||||
|
$fieldquery = [
|
||||||
|
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
|
||||||
|
'value' => sanitize_text_field( trim( $value ) ),
|
||||||
|
'compare' => apply_filters( 'opalestate_info_numeric_compare', '>=' ),
|
||||||
|
'type' => 'NUMERIC',
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$fieldquery = [
|
||||||
|
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
|
||||||
|
'value' => sanitize_text_field( trim( $value ) ),
|
||||||
|
'compare' => 'LIKE',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$sarg = apply_filters( 'opalestate_search_field_query_' . $key, $fieldquery );
|
||||||
|
$metaquery[] = $sarg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$args['meta_query'] = array_merge( $args['meta_query'], $metaquery );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $search_min_price != '' && $search_min_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
|
if ( $search_min_price != '' && $search_min_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
|
||||||
@ -637,13 +654,13 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
'validate_callback' => 'rest_validate_request_arg',
|
'validate_callback' => 'rest_validate_request_arg',
|
||||||
];
|
];
|
||||||
|
|
||||||
$params['info'] = [
|
// $params['info'] = [
|
||||||
'description' => __( 'Info', 'opalestate-pro' ),
|
// 'description' => __( 'Info', 'opalestate-pro' ),
|
||||||
'type' => 'array',
|
// 'type' => 'array',
|
||||||
// 'default' => '',
|
// // 'default' => '',
|
||||||
// 'sanitize_callback' => 'sanitize_text_field',
|
// // 'sanitize_callback' => 'sanitize_text_field',
|
||||||
'validate_callback' => 'rest_validate_request_arg',
|
// 'validate_callback' => 'rest_validate_request_arg',
|
||||||
];
|
// ];
|
||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'name' => esc_html__( 'Regular Price', 'opalestate-pro' ) . $currency,
|
'name' => esc_html__( 'Regular Price', 'opalestate-pro' ) . $currency,
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => esc_html__( 'Enter amount without currency', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter amount without currency', 'opalestate-pro' ),
|
||||||
'attributes' => [ 'required' => 'required' ],
|
|
||||||
'before_row' => '<div class="row-group-features group-has-three group-price clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Price', 'opalestate-pro' ) ) . '</h3>', // callback
|
'before_row' => '<div class="row-group-features group-has-three group-price clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Price', 'opalestate-pro' ) ) . '</h3>', // callback
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user