function ct_get_service_list($post_id = 0, $def_service_id = 0) { $services = ct_get_add_services_by_postid($post_id); echo '<option></option>'; if (!empty($services)) { foreach ($services as $service) { $selected = ''; $id = $service->id; if ($def_service_id == $id) { $selected = ' selected '; } echo '<option ' . esc_attr($selected) . 'value="' . esc_attr($id) . '">' . wp_kses_post($service->title) . '</option>'; } } }
// validation $required_params = array('tour_id'); foreach ($required_params as $param) { if (!isset($_REQUEST[$param])) { do_action('ct_tour_booking_wrong_data'); // ct_redirect_home() - if data is not valid return to home exit; } } // init variables $tour_id = $_REQUEST['tour_id']; $is_repeated = get_post_meta($tour_id, '_tour_repeated', true); $charge_child = get_post_meta($tour_id, '_tour_charge_child', true); $deposit_rate = get_post_meta($tour_id, '_tour_security_deposit', true); $deposit_rate = empty($deposit_rate) ? 0 : $deposit_rate; $add_services = ct_get_add_services_by_postid($tour_id); $date = ''; if (!empty($is_repeated)) { if (empty($_REQUEST['date'])) { do_action('ct_tour_booking_wrong_data'); // ct_redirect_home() - if data is not valid return to home exit; } $date = $_REQUEST['date']; } $uid = $tour_id . $date; $adults = isset($_REQUEST['adults']) ? $_REQUEST['adults'] : 1; $kids = isset($_REQUEST['kids']) ? $_REQUEST['kids'] : 0; if (($cart_data = CT_Hotel_Cart::get($uid)) && $adults == $cart_data['tour']['adults'] && $kids == $cart_data['tour']['kids']) { // init booking info if cart is not empty $total_price = $cart_data['tour']['total'];
$required_params = array('hotel_id', 'date_from', 'date_to'); foreach ($required_params as $param) { if (!isset($_REQUEST[$param])) { do_action('ct_hotel_booking_wrong_data'); // ct_redirect_home() - if data is not valid return to home exit; } } // init variables $hotel_id = $_REQUEST['hotel_id']; $date_from = $_REQUEST['date_from']; $date_to = $_REQUEST['date_to']; $room_ids = ct_hotel_get_available_rooms($hotel_id, $date_from, $date_to); $deposit_rate = get_post_meta($hotel_id, '_hotel_security_deposit', true); $deposit_rate = empty($deposit_rate) ? 0 : $deposit_rate; $add_services = ct_get_add_services_by_postid($hotel_id); $uid = $hotel_id . $date_from . $date_to; $cart = new CT_Hotel_Cart(); $cart_service = $cart->get_field($uid, 'add_service'); if (!ct_get_hotel_checkout_page()) { ?> <h5 class="alert alert-warning"><?php echo esc_html__('Please set checkout page in theme options panel.', 'citytours'); ?> </h5> <?php } else { // function if (!empty($room_ids) && is_array($room_ids)) { ?>