Update search

This commit is contained in:
Hoang Huu 2019-11-11 15:15:28 +07:00
parent c3efdabf1b
commit f171fe17f7
2 changed files with 16 additions and 6 deletions

View File

@ -139,10 +139,21 @@ function opalestate_api_get_property_data( $property_info ) {
$property['labels'] = $data->get_labels();
$property['locations'] = $data->get_locations();
$property['facilities'] = $data->get_facilities();
$property['amenities'] = $data->get_amenities();
$property['types'] = $data->get_types_tax();
$property['author_type'] = $data->get_author_type();
$property['author_data'] = $data->get_author_link_data();
$amenities = $data->get_amenities();
$amenities_result = [];
if ( $amenities ) {
foreach ( $amenities as $amenity ) {
$value = has_term( $amenity->term_id, 'opalestate_amenities', $property_info->ID );
$amenity->value = $value;
$amenities_result[] = $amenity;
}
}
$property['amenities'] = $amenities_result;
$property['types'] = $data->get_types_tax();
$property['author_type'] = $data->get_author_type();
$property['author_data'] = $data->get_author_link_data();
$limit = opalestate_get_option( 'single_views_statistics_limit', 8 );
$stats = new Opalestate_View_Stats( $data->get_id(), $limit );

View File

@ -114,7 +114,7 @@ class OpalEstate_Search {
[
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['amenities'] ),
'terms' => ( $_GET['amenities'] ),
];
}
@ -153,7 +153,6 @@ class OpalEstate_Search {
if ( $search_min_price != '' && $search_max_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
if ( $search_min_price ) {
array_push( $args['meta_query'], [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => [ $search_min_price, $search_max_price ],