<h3 class="inner"><?php echo esc_html__('- Summary -', 'citytours'); ?> </h3> <table class="table table_summary"> <tbody> <?php if (!empty($date)) { ?> <tr> <td><?php echo esc_html__('Date', 'citytours'); ?> </td> <td class="text-right"><?php echo date('j F Y', ct_strtotime($date)); ?> </td> </tr> <?php } ?> <tr> <td><?php echo esc_html__('Adults', 'citytours'); ?> </td> <td class="text-right"><?php echo esc_html($adults); ?> </td>
function ct_tour_submit_booking() { global $wpdb, $ct_options; // validation $result_json = array('success' => 0, 'result' => ''); if (!isset($_POST['uid']) || !CT_Hotel_Cart::get($_POST['uid'])) { $result_json['success'] = 0; $result_json['result'] = esc_html__('Sorry, some error occurred on input data validation.', 'citytours'); wp_send_json($result_json); } if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'checkout')) { $result_json['success'] = 0; $result_json['result'] = esc_html__('Sorry, your nonce did not verify.', 'citytours'); wp_send_json($result_json); } // init variables $uid = $_POST['uid']; $post_fields = array('first_name', 'last_name', 'email', 'phone', 'country', 'address1', 'address2', 'city', 'state', 'zip'); $order_info = ct_order_default_order_data('new'); foreach ($post_fields as $post_field) { if (!empty($_POST[$post_field])) { $order_info[$post_field] = sanitize_text_field($_POST[$post_field]); } } $latest_order_id = $wpdb->get_var('SELECT id FROM ' . CT_ORDER_TABLE . ' ORDER BY id DESC LIMIT 1'); $booking_no = mt_rand(1000, 9999); $booking_no .= $latest_order_id; $pin_code = mt_rand(1000, 9999); $cart_data = CT_Hotel_Cart::get($uid); $order_info['total_price'] = $cart_data['total_price']; $order_info['total_adults'] = $cart_data['total_adults']; $order_info['total_kids'] = $cart_data['total_kids']; $order_info['status'] = 'new'; // new $order_info['deposit_paid'] = 1; $order_info['mail_sent'] = 0; $order_info['post_id'] = $cart_data['tour_id']; if (!empty($cart_data['date'])) { $order_info['date_from'] = date('Y-m-d', ct_strtotime($cart_data['date'])); } $order_info['booking_no'] = $booking_no; $order_info['pin_code'] = $pin_code; // calculate deposit payment $deposit_rate = get_post_meta($cart_data['tour_id'], '_tour_security_deposit', true); // if woocommerce enabled change currency_code and exchange rate as default if (!empty($deposit_rate) && ct_is_woo_enabled()) { $order_info['currency_code'] = ct_get_def_currency(); $order_info['exchange_rate'] = 1; } else { if (!isset($_SESSION['exchange_rate'])) { ct_init_currency(); } $order_info['exchange_rate'] = $_SESSION['exchange_rate']; $order_info['currency_code'] = ct_get_user_currency(); } // if payment enabled set deposit price field if (!empty($deposit_rate) && ct_is_payment_enabled()) { $order_info['deposit_price'] = $deposit_rate / 100 * $order_info['total_price'] * $order_info['exchange_rate']; $order_info['deposit_paid'] = 0; // set unpaid if payment enabled $order_info['status'] = 'pending'; } $order_info['created'] = date('Y-m-d H:i:s'); $order_info['post_type'] = 'tour'; if ($wpdb->insert(CT_ORDER_TABLE, $order_info)) { CT_Hotel_Cart::_unset($uid); $order_id = $wpdb->insert_id; if (!empty($cart_data['tour'])) { $tour_booking_info = array(); $tour_booking_info['order_id'] = $order_id; $tour_booking_info['tour_id'] = $cart_data['tour_id']; $tour_booking_info['tour_date'] = $cart_data['date']; $tour_booking_info['adults'] = $cart_data['tour']['adults']; $tour_booking_info['kids'] = $cart_data['tour']['kids']; $tour_booking_info['total_price'] = $cart_data['tour']['total']; $wpdb->insert(CT_TOUR_BOOKINGS_TABLE, $tour_booking_info); } if (!empty($cart_data['add_service'])) { foreach ($cart_data['add_service'] as $service_id => $service_data) { $service_booking_info = array(); $service_booking_info['order_id'] = $order_id; $service_booking_info['add_service_id'] = $service_id; $service_booking_info['qty'] = $service_data['qty']; $service_booking_info['total_price'] = $service_data['total']; $wpdb->insert(CT_ADD_SERVICES_BOOKINGS_TABLE, $service_booking_info); } } $result_json['success'] = 1; $result_json['result']['order_id'] = $order_id; $result_json['result']['booking_no'] = $booking_no; $result_json['result']['pin_code'] = $pin_code; } else { $result_json['success'] = 0; $result_json['result'] = esc_html__('Sorry, An error occurred while add your order.', 'citytours'); } wp_send_json($result_json); }
function ct_ajax_submit_review() { global $wpdb; $result_json = array('success' => 0, 'result' => '', 'title' => ''); if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'post-' . $_POST['post_id'])) { $result_json['success'] = 0; $result_json['result'] = esc_html__('Sorry, your nonce did not verify.', 'citytours'); wp_send_json($result_json); } $fields = array('post_id', 'booking_no', 'pin_code', 'review_text', 'review_rating'); //validation $data = array(); foreach ($fields as $field) { $data[$field] = isset($_POST[$field]) ? sanitize_text_field($_POST[$field]) : ''; } $order = new CT_Hotel_Order($data['booking_no'], $data['pin_code']); if (!($order_data = $order->get_order_info())) { $result_json['success'] = 0; $result_json['result'] = esc_html__('Wrong Booking Number and Pin Code.', 'citytours'); wp_send_json($result_json); } if (!is_array($order_data) || $order_data['status'] == 'cancelled') { $result_json['success'] = 0; $result_json['title'] = esc_html__('Sorry, You cannot leave a rating.', 'citytours'); $result_json['result'] = esc_html__('You cancelled your booking, so cannot leave a rating.', 'citytours'); wp_send_json($result_json); } if (empty($order_data['date_to']) && ct_strtotime($order_data['date_from']) > ct_strtotime(date("Y-m-d")) || ct_strtotime($order_data['date_to']) > ct_strtotime(date("Y-m-d"))) { $result_json['success'] = 0; $result_json['title'] = esc_html__('Sorry, You cannot leave a rating before travel.', 'citytours'); $result_json['result'] = esc_html__('You can leave a review after travel.', 'citytours'); wp_send_json($result_json); } $data['post_id'] = $order_data['post_id']; $data['reviewer_name'] = $order_data['first_name'] . ' ' . $order_data['last_name']; $data['reviewer_email'] = $order_data['email']; $data['reviewer_ip'] = $_SERVER['REMOTE_ADDR']; $data['review_rating_detail'] = serialize($_POST['review_rating_detail']); $data['review_rating'] = array_sum($_POST['review_rating_detail']) / count($_POST['review_rating_detail']); $data['date'] = date('Y-m-d H:i:s'); $data['status'] = 'pending'; if (is_user_logged_in()) { $data['user_id'] = get_current_user_id(); } if (!($review_data = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . CT_REVIEWS_TABLE . ' WHERE booking_no=%d AND pin_code=%d', $data['booking_no'], $data['pin_code']), ARRAY_A))) { if ($wpdb->insert(CT_REVIEWS_TABLE, $data)) { $result_json['success'] = 1; $result_json['title'] = esc_html__('Thank you! Your review has been submitted successfully.', 'citytours'); $result_json['result'] = esc_html__('Your review has been submitted.', 'citytours'); } else { $result_json['success'] = 0; $result_json['title'] = esc_html__('Sorry, An error occurred while add review.', 'citytours'); $result_json['result'] = esc_html__('Please try again after a while.', 'citytours'); } } else { if ($wpdb->update(CT_REVIEWS_TABLE, $data, array('booking_no' => $data['booking_no'], 'pin_code' => $data['pin_code']))) { $result_json['success'] = 1; $result_json['title'] = esc_html__('Thank you! Your review has been submitted successfully.', 'citytours'); $result_json['result'] = esc_html__('You can change your review anytime.', 'citytours'); ct_review_calculate_rating($data['post_id']); } else { $result_json['success'] = 0; $result_json['title'] = esc_html__('Sorry, An error occurred while add review.', 'citytours'); $result_json['result'] = esc_html__('Please try again after a while.', 'citytours'); } } wp_send_json($result_json); }
function ct_hotel_calc_room_price($hotel_id, $room_type_id, $from_date, $to_date, $rooms = 1, $adults = 1, $kids = 0) { global $wpdb; $hotel_id = ct_hotel_org_id($hotel_id); $room_type_id = ct_room_org_id($room_type_id); //validation $room_hotel_id = get_post_meta($room_type_id, '_room_hotel_id', true); if ($room_hotel_id != $hotel_id) { return esc_html__('Room Type Id is not matched.', 'citytours'); } $max_adults = get_post_meta($room_type_id, '_room_max_adults', true); if (empty($max_adults)) { $max_adults = 0; } $max_kids = get_post_meta($room_type_id, '_room_max_kids', true); if (empty($max_adults)) { $max_kids = 0; } $avg_adults = ceil($adults / $rooms); $avg_kids = ceil($kids / $rooms); if ($avg_adults > $max_adults || $avg_adults + $avg_kids > $max_adults + $max_kids) { return esc_html__('Exceeds Max Guests.', 'citytours'); } if (time() - 60 * 60 * 24 > ct_strtotime($from_date)) { return esc_html__('Wrong Check In date. Please check again.', 'citytours'); } $minimum_stay = get_post_meta($hotel_id, '_hotel_minimum_stay', true); $minimum_stay = is_numeric($minimum_stay) ? $minimum_stay : 0; if (!ct_strtotime($from_date) || !ct_strtotime($to_date) || ct_strtotime($from_date) >= ct_strtotime($to_date) || ct_strtotime($from_date . ' + ' . $minimum_stay . ' days') > ct_strtotime($to_date)) { return esc_html__('Wrong Booking Date. Please check again.', 'citytours'); } $from_date_obj = new DateTime('@' . ct_strtotime($from_date)); $to_date_obj = new DateTime('@' . ct_strtotime($to_date)); $date_interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($from_date_obj, $date_interval, $to_date_obj); $price_data = array(); $total_price = 0.0; $hotel_id = esc_sql($hotel_id); $room_type_id = esc_sql($room_type_id); $rooms = esc_sql($rooms); $adults = esc_sql($adults); $kids = esc_sql($kids); foreach ($period as $dt) { $check_date = esc_sql($dt->format("Y-m-d")); $check_dates[] = $check_date; $sql = "SELECT vacancies.room_type_id, vacancies.price_per_room , vacancies.price_per_person, vacancies.price_per_child\r\n\t\t\t\t\tFROM (SELECT room_type_id, rooms, price_per_room, price_per_person, price_per_child\r\n\t\t\t\t\t\t\tFROM " . CT_HOTEL_VACANCIES_TABLE . " \r\n\t\t\t\t\t\t\tWHERE 1=1 AND hotel_id='" . $hotel_id . "' AND room_type_id = '" . $room_type_id . "' AND date_from <= '" . $check_date . "' AND date_to > '" . $check_date . "' ) AS vacancies\r\n\t\t\t\t\tLEFT JOIN (SELECT hotel_booking.room_type_id, SUM(hotel_booking.rooms) AS rooms \r\n\t\t\t\t\t\t\tFROM " . CT_HOTEL_BOOKINGS_TABLE . " AS hotel_booking \r\n\t\t\t\t\t\t\tINNER JOIN " . CT_ORDER_TABLE . " as hotel_order on hotel_order.id = hotel_booking.order_id\r\n\t\t\t\t\t\t\tWHERE 1=1 AND hotel_order.status!='cancelled' AND hotel_order.post_id='" . $hotel_id . "' AND hotel_booking.room_type_id = '" . $room_type_id . "' AND hotel_order.date_to > '" . $check_date . "' AND hotel_order.date_from <= '" . $check_date . "'" . (empty($except_booking_no) || empty($pin_code) ? "" : " AND NOT ( hotel_order.booking_no = '" . $except_booking_no . "' AND hotel_order.pin_code = '" . $pin_code . "' )") . "\r\n\t\t\t\t\t) AS bookings ON vacancies.room_type_id = bookings.room_type_id\r\n\t\t\t\t\tWHERE vacancies.rooms - IFNULL(bookings.rooms,0) >= " . $rooms . ";"; $result = $wpdb->get_row($sql); // object (room_type_id, price_per_room, price_per_person, price_per_child) if (empty($result)) { //if no available rooms on selected date return esc_html__('Sorry, The room you are booking now is just taken by another customer. Please have another look.', 'citytours'); } else { $price_per_room = (double) $result->price_per_room; $price_per_person = (double) $result->price_per_person; $price_per_child = (double) $result->price_per_child; $day_price = $price_per_room * $rooms + $price_per_person * $adults + $price_per_child * $kids; $price_data[$check_date] = array('ppr' => $price_per_room, 'ppp' => $price_per_person, 'ppc' => $price_per_child, 'total' => $day_price); $total_price += $day_price; } } $return_value = array('check_dates' => $check_dates, 'prices' => $price_data, 'total_price' => $total_price); return $return_value; }
function ct_tour_get_search_result($args) { global $ct_options, $wpdb; $s = ''; $date = ''; $adults = 1; $kids = 0; $tour_type = array(); $price_filter = array(); $rating_filter = array(); $facility_filter = array(); $order_by = ''; $order = ''; $last_no = 0; $per_page = isset($ct_options['tour_posts']) && is_numeric($ct_options['tour_posts']) ? $ct_options['tour_posts'] : 6; extract($args); $order_array = array('ASC', 'DESC'); $order_by_array = array('' => '', 'price' => 'convert(meta_price.meta_value, decimal)', 'rating' => 'meta_rating.meta_value'); if (!array_key_exists($order_by, $order_by_array)) { $order_by = ''; } if (!in_array($order, $order_array)) { $order = 'ASC'; } $tbl_posts = esc_sql($wpdb->posts); $tbl_postmeta = esc_sql($wpdb->postmeta); $tbl_terms = esc_sql($wpdb->prefix . 'terms'); $tbl_term_taxonomy = esc_sql($wpdb->prefix . 'term_taxonomy'); $tbl_term_relationships = esc_sql($wpdb->prefix . 'term_relationships'); $tbl_icl_translations = esc_sql($wpdb->prefix . 'icl_translations'); $temp_tbl_name = esc_sql('Search_' . session_id()); $s_query = "SELECT DISTINCT post_s1.ID AS tour_id FROM {$tbl_posts} AS post_s1 WHERE (post_s1.post_status = 'publish') AND (post_s1.post_type = 'tour')"; // search filter if (!empty($s)) { $s_query .= " AND ((post_s1.post_title LIKE '%{$s}%') OR (post_s1.post_content LIKE '%{$s}%') )"; } // if wpml is enabled do search by default language post if (defined('ICL_LANGUAGE_CODE') && ct_get_lang_count() > 1) { $s_query = "SELECT DISTINCT it2.element_id AS tour_id FROM ({$s_query}) AS t0\r\n\t\t\t\t\t\tINNER JOIN {$tbl_icl_translations} it1 ON (it1.element_type = 'post_tour') AND it1.element_id = t0.tour_id\r\n\t\t\t\t\t\tINNER JOIN {$tbl_icl_translations} it2 ON (it2.element_type = 'post_tour') AND it2.language_code='" . ct_get_default_language() . "' AND it2.trid = it1.trid "; } $sql = "SELECT t1.* FROM ( {$s_query} ) AS t1 "; if (!empty($date)) { $date = esc_sql(date('Y-m-d', ct_strtotime($date))); $sql .= " LEFT JOIN {$tbl_postmeta} AS meta_c1 ON (meta_c1.meta_key = '_tour_max_people') AND (t1.tour_id = meta_c1.post_id)"; $sql .= " LEFT JOIN {$tbl_postmeta} AS meta_c2 ON (meta_c2.meta_key = '_tour_repeated') AND (t1.tour_id = meta_c2.post_id)"; $sql .= " LEFT JOIN {$tbl_postmeta} AS meta_c3 ON (meta_c3.meta_key = '_tour_date') AND (t1.tour_id = meta_c3.post_id)"; $sql .= " LEFT JOIN ( SELECT tour_booking.tour_id, SUM( tour_booking.adults ) as adults, SUM( tour_booking.kids ) as kids FROM " . CT_TOUR_BOOKINGS_TABLE . " AS tour_booking\r\n\t\t\t\t\t\tINNER JOIN " . CT_ORDER_TABLE . " as tour_order \r\n\t\t\t\t\t\tON tour_order.id = tour_booking.order_id AND tour_order.status!='cancelled'\r\n\t\t\t\t\t\tWHERE tour_order.date_from = '{$date}'\r\n\t\t\t\t\t\tGROUP BY tour_booking.tour_id ) AS booking_info ON booking_info.tour_id = t1.tour_id"; $sql .= " WHERE (( meta_c2.meta_value=1 ) OR ( meta_c2.meta_value=0 AND meta_c3.meta_value='{$date}' )) \r\n\t\t\t\t\t\tAND ((meta_c1.meta_value IS NULL) OR (meta_c1.meta_value='') OR (meta_c1.meta_value-IFNULL(booking_info.adults, 0) > {$adults}) )"; } // if wpml is enabled return current language posts if (defined('ICL_LANGUAGE_CODE') && ct_get_lang_count() > 1 && ct_get_default_language() != ICL_LANGUAGE_CODE) { $sql = "SELECT it4.element_id AS tour_id FROM ({$sql}) AS t5\r\n\t\t\t\t\tINNER JOIN {$tbl_icl_translations} it3 ON (it3.element_type = 'post_hotel') AND it3.element_id = t5.tour_id\r\n\t\t\t\t\tINNER JOIN {$tbl_icl_translations} it4 ON (it4.element_type = 'post_hotel') AND it4.language_code='" . ICL_LANGUAGE_CODE . "' AND it4.trid = it3.trid"; } $sql = "CREATE TEMPORARY TABLE IF NOT EXISTS {$temp_tbl_name} AS " . $sql; $wpdb->query($sql); $sql = " FROM {$temp_tbl_name} as t1\r\n\t\t\t\tINNER JOIN {$tbl_posts} post_s1 ON (t1.tour_id = post_s1.ID) AND (post_s1.post_status = 'publish') AND (post_s1.post_type = 'tour')"; $where = ' WHERE 1=1'; // tour_type filter if (!empty($tour_type) && trim(implode('', $tour_type)) != "") { $sql .= " INNER JOIN {$tbl_term_relationships} AS tr ON tr.object_id = post_s1.ID \r\n\t\t\t\t\tINNER JOIN {$tbl_term_taxonomy} AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; $where .= " AND tt.taxonomy = 'tour_type' AND tt.term_id IN (" . esc_sql(implode(',', $tour_type)) . ")"; } // price filter $sql .= " LEFT JOIN {$tbl_postmeta} AS meta_price ON post_s1.ID = meta_price.post_id AND meta_price.meta_key = '_tour_price'"; if (!empty($price_filter) && trim(implode('', $price_filter)) != "") { $price_where = array(); $price_steps = empty($ct_options['tour_price_filter_steps']) ? '50,80,100' : $ct_options['tour_price_filter_steps']; $step_arr = explode(',', $price_steps); array_unshift($step_arr, 0); foreach ($price_filter as $index) { if ($index < count($step_arr) - 1) { // 80 ~ 100 case $price_where[] = "( cast(meta_price.meta_value as unsigned) BETWEEN " . esc_sql($step_arr[$index]) . " AND " . esc_sql($step_arr[$index + 1]) . " )"; } else { // 200+ case $price_where[] = "( cast(meta_price.meta_value as unsigned) >= " . esc_sql($step_arr[$index]) . " )"; } } $where .= " AND ( " . implode(' OR ', $price_where) . " )"; } // review filter $sql .= " LEFT JOIN {$tbl_postmeta} AS meta_rating ON post_s1.ID = meta_rating.post_id AND meta_rating.meta_key = '_review'"; if (!empty($rating_filter) && trim(implode('', $rating_filter)) != "") { $where .= " AND round( cast( IFNULL( meta_rating.meta_value, 0 ) AS decimal(2,1) ) ) IN ( " . esc_sql(implode(',', $rating_filter)) . " )"; } // facility filter if (!empty($facility_filter) && trim(implode('', $facility_filter)) != "") { $where .= " AND (( SELECT COUNT(1) FROM {$tbl_term_relationships} AS tr1 \r\n\t\t\t\t\tINNER JOIN {$tbl_term_taxonomy} AS tt1 ON ( tr1.term_taxonomy_id= tt1.term_taxonomy_id )\r\n\t\t\t\t\tWHERE tt1.taxonomy = 'tour_facility' AND tt1.term_id IN (" . esc_sql(implode(',', $facility_filter)) . ") AND tr1.object_id = post_s1.ID ) = " . count($facility_filter) . ")"; } $sql .= $where; $count_sql = "SELECT COUNT(DISTINCT t1.tour_id)" . $sql; $count = $wpdb->get_var($count_sql); if (!empty($order_by)) { $sql .= " ORDER BY " . $order_by_array[$order_by] . " " . $order; } $sql .= " LIMIT {$last_no}, {$per_page};"; $main_sql = "SELECT DISTINCT t1.tour_id AS tour_id" . $sql; $ids = $wpdb->get_results($main_sql, ARRAY_A); return array('count' => $count, 'ids' => $ids); }
<?php get_header(); global $ct_options, $post_list, $current_view; $order_array = array('ASC', 'DESC'); $order_by_array = array('' => '', 'price' => 'price', 'rating' => 'rating'); $order_defaults = array('price' => 'ASC', 'rating' => 'DESC'); $s = isset($_REQUEST['s']) ? sanitize_text_field($_REQUEST['s']) : ''; $date_from = isset($_REQUEST['date_from']) ? ct_sanitize_date($_REQUEST['date_from']) : ''; $date_to = isset($_REQUEST['date_to']) ? ct_sanitize_date($_REQUEST['date_to']) : ''; if (ct_strtotime($date_from) >= ct_strtotime($date_to)) { $date_from = ''; $date_to = ''; } $rooms = isset($_REQUEST['rooms']) && is_numeric($_REQUEST['rooms']) ? sanitize_text_field($_REQUEST['rooms']) : 1; $adults = isset($_REQUEST['adults']) && is_numeric($_REQUEST['adults']) ? sanitize_text_field($_REQUEST['adults']) : 1; $kids = isset($_REQUEST['kids']) && is_numeric($_REQUEST['kids']) ? sanitize_text_field($_REQUEST['kids']) : 0; $order_by = isset($_REQUEST['order_by']) && array_key_exists($_REQUEST['order_by'], $order_by_array) ? sanitize_text_field($_REQUEST['order_by']) : ''; $order = isset($_REQUEST['order']) && in_array($_REQUEST['order'], $order_array) ? sanitize_text_field($_REQUEST['order']) : 'ASC'; $districts = isset($_REQUEST['districts']) ? is_array($_REQUEST['districts']) ? $_REQUEST['districts'] : array($_REQUEST['districts']) : array(); $price_filter = isset($_REQUEST['price_filter']) && is_array($_REQUEST['price_filter']) ? $_REQUEST['price_filter'] : array(); $star_filter = isset($_REQUEST['star_filter']) && is_array($_REQUEST['star_filter']) ? $_REQUEST['star_filter'] : array(); $rating_filter = isset($_REQUEST['rating_filter']) && is_array($_REQUEST['rating_filter']) ? $_REQUEST['rating_filter'] : array(); $facility_filter = isset($_REQUEST['facilities']) && is_array($_REQUEST['facilities']) ? $_REQUEST['facilities'] : array(); $current_view = isset($_REQUEST['view']) ? sanitize_text_field($_REQUEST['view']) : 'list'; $page = isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) && $_REQUEST['page'] >= 1 ? sanitize_text_field($_REQUEST['page']) : 1; $per_page = isset($ct_options['hotel_posts']) && is_numeric($ct_options['hotel_posts']) ? $ct_options['hotel_posts'] : 6; $search_result = ct_hotel_get_search_result(array('s' => $s, 'date_from' => $date_from, 'date_to' => $date_to, 'rooms' => $rooms, 'adults' => $adults, 'kids' => $kids, 'star_filter' => $star_filter, 'district' => $districts, 'price_filter' => $price_filter, 'rating_filter' => $rating_filter, 'facility_filter' => $facility_filter, 'order_by' => $order_by_array[$order_by], 'order' => $order, 'last_no' => ($page - 1) * $per_page, 'per_page' => $per_page)); $post_list = $search_result['ids']; $count = $search_result['count']; // total_count