public function _checkout_form_validate()
 {
     $cart = STCart::get_carts();
     if (is_array($cart) && count($cart)) {
         $cart_hotel = ValidateNormalCheckout::get_cart_data($cart, 'st_hotel');
         $validate_hotel = ValidateNormalCheckout::_validate_cart_hotel($cart_hotel);
         if (!$validate_hotel) {
             $message = $_SESSION['flash_validate_checkout'];
             STTemplate::set_message($message);
             return false;
         }
         $cart_rental = ValidateNormalCheckout::get_cart_data($cart, 'st_rental');
         $validate_rental = ValidateNormalCheckout::_validate_cart_rental($cart_rental);
         if (!$validate_rental) {
             $message = $_SESSION['flash_validate_checkout'];
             STTemplate::set_message($message);
             return false;
         }
     }
     return true;
 }
Example #2
0
 /**
  * Validate if order is available to show booking infomation
  *
  * @since 1.0.8
  *
  * */
 function success_page_validate()
 {
     $order_code = STInput::get('order_code');
     $order_token_code = STInput::get('order_token_code');
     if ($order_token_code) {
         $order_code = STOrder::get_order_id_by_token($order_token_code);
     }
     $status = get_post_meta($order_code, 'status', true);
     $result = true;
     if ($status == 'incomplete') {
         // try to check payment complete
         $paypal = new STPaypal();
         $r = $paypal->check_completePurchase($order_code);
         if ($r) {
             if (isset($r['status'])) {
                 if ($r['status']) {
                     $result = true;
                     update_post_meta($order_code, 'status', 'complete');
                     $status = 'complete';
                     do_action('st_email_after_booking', $order_code);
                     do_action('st_booking_submit_form_success', $order_code);
                 } elseif (isset($r['message']) and $r['message']) {
                     $result = false;
                     STTemplate::set_message($r['message'], 'danger');
                 }
                 if (isset($r['redirect_url']) and $r['redirect_url']) {
                     echo "<script>window.location.href='" . $r['redirect_url'] . "'</script>";
                     die;
                 }
             }
         }
     }
     if ($status == 'incomplete') {
         $result = false;
         STTemplate::set_message(__("Sorry! Your payment is incomplete."));
     }
     return $result;
 }
 function _add_cart_check_available($post_id = false, $data = array())
 {
     if (!$post_id or get_post_status($post_id) != 'publish') {
         STTemplate::set_message(__('Rental doese not exists', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     $validator = new STValidate();
     $validator->set_rules('start', __('Check in', ST_TEXTDOMAIN), 'required');
     $validator->set_rules('end', __('Check out', ST_TEXTDOMAIN), 'required');
     if (!$validator->run()) {
         STTemplate::set_message($validator->error_string(), 'danger');
         return false;
     }
     $check_in = date('Y-m-d H:i:s', strtotime(STInput::post('start')));
     $check_out = date('Y-m-d H:i:s', strtotime(STInput::post('end')));
     if (!$this->_is_slot_available($post_id, $check_in, $check_out)) {
         STTemplate::set_message(__('Sorry! This rental is not available.', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     return true;
 }
Example #4
0
 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = intval(STInput::request('item_id', ''));
     if ($item_id <= 0 || get_post_type($item_id) != 'st_activity') {
         STTemplate::set_message(__('This activity is not available..', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $number = 1;
     $type_activity = STInput::request('type_activity', 'specific_date');
     $adult_number = intval(STInput::request('adult_number', 1));
     $child_number = intval(STInput::request('child_number', 0));
     $infant_number = intval(STInput::request('infant_number', 0));
     $max_number = intval(get_post_meta($item_id, 'max_people', true));
     $today = date('Y-m-d');
     if ($adult_number + $child_number + $infant_number > $max_number) {
         STTemplate::set_message(sprintf(__('Max of people for this activity is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($type_activity == 'specific_date') {
         $check_in = TravelHelper::convertDateFormat(STInput::request('check_in', ''));
         $check_out = TravelHelper::convertDateFormat(STInput::request('check_out', ''));
         if (empty($check_in)) {
             STTemplate::set_message(__('The check in field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if (empty($check_out)) {
             STTemplate::set_message(__('The check out field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $compare = TravelHelper::dateCompare($today, $check_in);
         if ($compare < 0) {
             STTemplate::set_message(__('This activity has expired', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $people = $adult_number + $child_number + $child_number;
         $result = ActivityHelper::_get_free_peple_special($item_id, $check_in, $check_out);
         $free_people = intval(get_post_meta($item_id, 'max_people', true));
         if (is_array($result) && count($result)) {
             $free_people = intval($result['free_people']);
         }
         if ($free_people < $people) {
             STTemplate::set_message(sprintf(__('This activity only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
             $pass_validate = false;
             return false;
         }
         $data['check_in'] = date('m/d/Y', strtotime($check_in));
         $data['check_out'] = date('m/d/Y', strtotime($check_out));
     } elseif ($type_activity == 'daily_activity') {
         $check_in = STInput::request('check_in', '');
         if (empty($check_in)) {
             STTemplate::set_message(__('The check in field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $check_in = TravelHelper::convertDateFormat($check_in);
         $check_in = date('Y-m-d', strtotime($check_in));
         $duration = intval(get_post_meta($item_id, 'duration', true));
         $check_out = $duration >= 2 ? strtotime('+ ' . $duration . ' days', strtotime($check_in)) : strtotime('+ ' . $duration . ' day', strtotime($check_in));
         $check_out = date('Y-m-d', $check_out);
         $booking_period = intval(get_post_meta($item_id, 'activity_booking_period', true));
         $period = TravelHelper::dateDiff($today, $check_in);
         $compare = TravelHelper::dateCompare($today, $check_in);
         if ($compare < 0) {
             STTemplate::set_message(__('You can not set check-in date in the past', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($booking_period && $booking_period > $period) {
             STTemplate::set_message(sprintf(__('This activity allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
             return false;
         }
         $people = $adult_number + $child_number + $child_number;
         $result = ActivityHelper::_get_free_peple_daily($item_id, $check_in);
         $free_people = intval(get_post_meta($item_id, 'max_people', true));
         if (is_array($result) && count($result)) {
             $free_people = intval($result['free_people']);
         }
         if ($free_people < $people) {
             STTemplate::set_message(sprintf(__('This activity only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
             $pass_validate = false;
             return false;
         }
         $data['duration'] = $duration;
     }
     $data['adult_number'] = $adult_number;
     $data['child_number'] = $child_number;
     $data['infant_number'] = $infant_number;
     $data['check_in'] = date('m/d/Y', strtotime($check_in));
     $data['check_out'] = date('m/d/Y', strtotime($check_out));
     $data['type_activity'] = $type_activity;
     $data_price = STPrice::getPriceByPeople($item_id, strtotime($check_in), strtotime($check_out), $adult_number, $child_number, $infant_number);
     $total_price = $data_price['total_price'];
     $sale_price = STPrice::getSaleTourSalePrice($item_id, $total_price, $type_activity, strtotime($check_in));
     $discount_rate = STPrice::get_discount_rate($item_id, strtotime($check_in));
     $data['adult_price'] = floatval(get_post_meta($item_id, 'adult_price', true));
     $data['child_price'] = floatval(get_post_meta($item_id, 'child_price', true));
     $data['infant_price'] = floatval(get_post_meta($item_id, 'infant_price', true));
     $data['ori_price'] = $sale_price;
     $data['currency'] = TravelHelper::get_current_currency('symbol');
     $data['currency_rate'] = TravelHelper::get_current_currency('rate');
     $data['currency_pos'] = TravelHelper::get_current_currency('booking_currency_pos');
     $data['commission'] = TravelHelper::get_commission();
     $data['data_price'] = $data_price;
     $data['discount_rate'] = $discount_rate;
     if ($pass_validate) {
         $pass_validate = apply_filters('st_activity_add_cart_validate', $pass_validate);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $sale_price, $data);
     }
     return $pass_validate;
 }
Example #5
0
 function do_add_to_cart($array = array())
 {
     $pass_validate = TRUE;
     $default = array('item_id' => '', 'number_room' => 1, 'price' => '', 'data_price' => '', 'check_in' => '', 'check_out' => '', 'room_num_search' => '', 'room_id' => '', 'adult_num' => 1, 'child_num' => 0);
     $array = wp_parse_args($array, $default);
     extract($array);
     $data = array('check_in' => $check_in, 'check_out' => $check_out, 'data_price' => $data_price, 'currency' => TravelHelper::get_default_currency('symbol'), 'room_num_search' => $room_num_search, 'room_id' => $room_id, 'room_data' => array(), 'adult_num' => $adult_num, 'child_num' => $child_num);
     if (empty($check_in)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if (empty($check_out)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     $num_room = intval(get_post_meta($room_id, 'number_room', true));
     $adult = intval(get_post_meta($room_id, 'adult_number', true));
     $children = intval(get_post_meta($room_id, 'children_number', true));
     if ($room_num_search > $num_room) {
         STTemplate::set_message(__('Max of rooms are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if ($adult_num > $adult) {
         STTemplate::set_message(__('Number of adults in the room are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if ($child_num > $children) {
         STTemplate::set_message(__('Number of children in the room are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     if (!$this->_is_slot_available($room_id, $check_in, $check_out)) {
         STTemplate::set_message(__('Sorry! This Room is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
     }
     $today = date('m/d/Y');
     $booking_period = $this->is_booking_period($item_id, $today, $check_in);
     if ($booking_period) {
         STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
         $pass_validate = FALSE;
     }
     if ($pass_validate) {
         $pass_validate = apply_filters('st_hotel_add_cart_validate', $pass_validate, $array);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $number_room, $price, $data);
     }
     return $pass_validate;
 }
<?php

/**
* @since 1.1.3
**/
get_header();
get_template_part('breadcrumb');
?>
<div class="booking-item-details">
	<?php 
$detail_tour_layout = apply_filters('st_rental_room_layout', '');
if ($detail_tour_layout && !empty($detail_tour_layout)) {
    echo STTemplate::get_vc_pagecontent($detail_tour_layout);
} else {
    echo do_shortcode('
                [vc_row][vc_column width="2/3"][st_rental_room_header][st_rental_room_content][st_rental_room_gallery style="slide"][/vc_column][vc_column width="1/3"][st_related_rental_room header_title="Related Rental Room" number_of_room="5" show_excerpt="yes"][/vc_column][/vc_row]
            ');
}
?>
</div>
<?php 
get_footer();
Example #7
0
$result_string = '';
echo st()->load_template('search-loading');
?>
    <div class="mfp-with-anim mfp-dialog mfp-search-dialog mfp-hide" id="search-dialog">
        <?php 
echo st()->load_template('cars/search-form');
?>
    </div>
    <div class="container">
        <h3 class="booking-title"><?php 
echo balanceTags($cars->get_result_string());
?>
            <small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out"><?php 
st_the_language('change_search');
?>
</a></small>
        </h3>
        <?php 
$cars_search_layout = st()->get_option('cars_layout_layout');
if (!empty($_REQUEST['layout_id'])) {
    $cars_search_layout = $_REQUEST['layout_id'];
}
if ($cars_search_layout) {
    echo STTemplate::get_vc_pagecontent($cars_search_layout);
} else {
    echo st()->load_template('cars/search-default');
}
?>
    </div>
<?php 
get_footer();
 /**
  * @since 1.0.9
  **/
 function activity_add_to_cart()
 {
     if (STInput::get('action') == 'activity_add_to_cart') {
         $item_id = STInput::get('item_id');
         $number = STInput::get('number');
         $discount = STInput::get('discount');
         if (!empty($discount)) {
             $price = STInput::get('price');
             $price = $price - $price * ($discount / 100);
             $data = array('discount' => $discount, 'price_old' => STInput::get('price'), 'price_sale' => $price);
         } else {
             $price = STInput::get('price');
         }
         $data['check_in'] = STInput::get('check_in');
         $data['check_out'] = STInput::get('check_out');
         $data['type_price'] = STInput::request('type_price');
         if ($data['type_price'] == 'people_price') {
             $prices = self::get_price_person($item_id);
             $data['adult_price'] = $prices['adult'];
             $data['child_price'] = $prices['child'];
             $data['discount'] = $prices['discount'];
             $data['adult_number'] = STInput::request('adult_number', 1);
             $data['child_number'] = STInput::request('children_number', 0);
         }
         /* Check booking period */
         $today = strtotime(date('m/d/Y'));
         $check_out = strtotime(STInput::get('check_out'));
         //$period = STDate::date_diff($today,$check_in);
         $expired = $today - $check_out;
         if ($expired >= 0) {
             STTemplate::set_message(__('This activity has expired', ST_TEXTDOMAIN), 'danger');
             return;
         } else {
             STCart::add_cart($item_id, $number, $price, $data);
             $link = STCart::get_cart_link();
             wp_safe_redirect($link);
             die;
         }
     }
 }
 /**
  * Check if a gateway is allow to show the booking infomation by gived gateway id
  *
  * @param $id: GateWay Name
  *
  * @result bool
  *
  * @since 1.0.8
  *
  * */
 static function gateway_success_page_validate($id = false)
 {
     $all = self::get_payment_gateways();
     if (isset($all[$id])) {
         $value = $all[$id];
         if (method_exists($value, 'get_name')) {
             return $value->success_page_validate();
         }
     } else {
         STTemplate::set_message(__('Sorry! Your Payment Gateway is not valid', ST_TEXTDOMAIN), 'danger');
     }
 }
Example #10
0
 /**
  * @since 1.0.9
  * @update 1.1.3
  **/
 function do_add_to_cart()
 {
     $pass_validate = true;
     $data_price_cars = json_decode(str_ireplace("\\", '', STInput::request('data_price_cars')));
     $data_price_items = json_decode(str_ireplace("\\", '', STInput::request('data_price_items')));
     $selected_equipments = json_decode(str_ireplace("\\", '', STInput::request('selected_equipments')));
     $discount = STInput::request('discount');
     $price_unit = STInput::request('price');
     $price_old = STInput::request('price_old');
     $item_id = STInput::request('item_id');
     $number = 1;
     $price_total = STInput::request('data_price_total');
     $check_in = $data_price_cars->date_time->pick_up_date . ' ' . $data_price_cars->date_time->pick_up_time;
     $check_in = date('Y-m-d H:i:s', strtotime($check_in));
     $check_out = $data_price_cars->date_time->drop_off_date . ' ' . $data_price_cars->date_time->drop_off_time;
     $check_out = date('Y-m-d H:i:s', strtotime($check_out));
     $data = array('data_price_cars' => $data_price_cars, 'data_price_items' => $data_price_items, 'discount' => $discount, 'price_old' => $price_old, 'check_in' => STInput::request('check_in'), 'check_in_timestamp' => STInput::request('check_in_timestamp'), 'check_out' => STInput::request('check_out'), 'check_out_timestamp' => STInput::request('check_out_timestamp'), 'price_total' => $price_total, 'price_unit' => self::get_price_unit(), 'selected_equipments' => $selected_equipments);
     // Validate required field
     $change_location_date_box = $this->get_search_fields_box();
     $field_types = $this->get_search_fields_name();
     if (!empty($change_location_date_box)) {
         $message = '';
         foreach ($change_location_date_box as $key => $value) {
             if (isset($field_types[$value['field_atrribute']]) and $value['is_required'] == 'on') {
                 $field_name = isset($field_types[$value['field_atrribute']]['field_name']) ? $field_types[$value['field_atrribute']]['field_name'] : false;
                 if ($field_name) {
                     if (is_array($field_name)) {
                         foreach ($field_name as $v) {
                             if (!STInput::request($v)) {
                                 $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                                 $pass_validate = false;
                             }
                         }
                     } elseif (is_string($field_name)) {
                         if (!STInput::request($field_name)) {
                             $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                             $pass_validate = false;
                         }
                     }
                 }
             }
         }
         if ($message) {
             $message = substr($message, 0, -4);
             STTemplate::set_message($message, 'danger');
         }
     }
     $is_required_country = st()->get_option('is_required_country', 'off');
     if ($is_required_country == 'on') {
         if (STInput::request('county_pick_up') != STInput::request('county_drop_off') or !STInput::request('county_drop_off') or !STInput::request('county_pick_up')) {
             STTemplate::set_message(__('Pick-up and Drop-off are not in the same country. Please re-check it.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
         }
     }
     $today = strtotime(date('m/d/Y', time()));
     $check_in_unix = strtotime(TravelHelper::convertDateFormat($data_price_cars->date_time->pick_up_date));
     $booking_period = intval(get_post_meta($item_id, 'cars_booking_period', true));
     $period = STDate::date_diff($today, $check_in_unix);
     $var = $check_in_unix - $today;
     if ($var < 0) {
         STTemplate::set_message(__('You can not set check-in date in the past'), 'danger');
         $pass_validate = false;
     } else {
         if ($booking_period && $period < $booking_period) {
             STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
         }
     }
     if (!$this->_is_slot_available($item_id, $check_in, $check_out)) {
         STTemplate::set_message(__('Sorry! This Car is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
     }
     //if($pickup)
     // Allow to be filtered
     $pass_validate = apply_filters('st_car_add_cart_validate', $pass_validate, $item_id, $number, $price_unit, $data);
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $price_unit, $data);
     }
     return $pass_validate;
 }
Example #11
0
 static function ajax_submit_form()
 {
     //Add to cart then submit form
     $item_id = STInput::post('item_id');
     $sc = STInput::request('sc', '');
     if (!$item_id) {
         $name = '';
         if ($sc == 'add-hotel-booking') {
             $name = __('Hotel', ST_TEXTDOMAIN);
         } elseif ($sc == 'add-rental-booking') {
             $name = __('Rental', ST_TEXTDOMAIN);
         } elseif ($sc == 'add-car-booking') {
             $name = __('Car', ST_TEXTDOMAIN);
         } elseif ($sc == 'add-tour-booking') {
             $name = __('Tour', ST_TEXTDOMAIN);
         } elseif ($sc == 'add-holiday-booking') {
             $name = __('Holiday', ST_TEXTDOMAIN);
         } elseif ($sc == 'add-activity-booking') {
             $name = __('Activity', ST_TEXTDOMAIN);
         }
         $return = array('status' => false, 'message' => sprintf(__('Please choose a %s item ', ST_TEXTDOMAIN), $name));
     } else {
         $post_type = get_post_type($item_id);
         $number_room = STInput::post('number_room') ? STInput::post('number_room') : false;
         if (!$number_room) {
             $number_room = STInput::post('room_num_search') ? STInput::post('room_num_search') : 1;
         }
         self::destroy_cart();
         $validate = true;
         switch ($post_type) {
             case "st_hotel":
                 $hotel = new STHotel();
                 $validate = $hotel->do_add_to_cart();
                 break;
             case "st_cars":
                 $car = new STCars();
                 $validate = $car->do_add_to_cart();
                 break;
             case "st_activity":
                 $class = new STActivity();
                 $validate = $class->do_add_to_cart();
                 break;
             case "st_tours":
                 $class = new STTour();
                 $validate = $class->do_add_to_cart();
                 break;
             case "st_holidays":
                 $class = new STHoliday();
                 $validate = $class->do_add_to_cart();
                 break;
             case "st_rental":
                 $class = new STRental();
                 $validate = $class->do_add_to_cart();
                 break;
         }
         if ($validate) {
             $return = self::booking_form_submit($item_id);
         } else {
             $return = array('status' => false, 'message' => STTemplate::get_message_content());
             STTemplate::clear();
         }
     }
     echo json_encode($return);
     die;
 }
Example #12
0
 static function ajax_submit_form()
 {
     //Add to cart then submit form
     $item_id = STInput::post('item_id');
     if (!$item_id) {
         $return = array('status' => false, 'message' => __('Please choose an item', ST_TEXTDOMAIN));
     } else {
         $post_type = get_post_type($item_id);
         $number_room = STInput::post('number_room') ? STInput::post('number_room') : false;
         if (!$number_room) {
             $number_room = STInput::post('room_num_search') ? STInput::post('room_num_search') : 1;
         }
         self::destroy_cart();
         $validate = true;
         switch ($post_type) {
             case "st_hotel":
                 $hotel = new STHotel();
                 $validate = $hotel->do_add_to_cart(array('item_id' => STInput::post('item_id'), 'number_room' => $number_room, 'price' => STInput::post('price'), 'check_in' => STInput::post('check_in'), 'check_out' => STInput::post('check_out'), 'room_num_search' => STInput::post('room_num_search'), 'room_num_config' => STInput::post('room_num_config'), 'room_id' => STInput::post('room_id')));
                 break;
             case "st_cars":
                 $car = new STCars();
                 $validate = $car->do_add_to_cart();
                 break;
             case "st_activity":
                 $class = new STActivity();
                 $validate = $class->do_add_to_cart();
                 break;
             case "st_tours":
                 $class = new STTour();
                 $validate = $class->do_add_to_cart();
                 break;
             case "st_rental":
                 $class = new STRental();
                 $validate = $class->do_add_to_cart();
                 break;
         }
         if ($validate) {
             $return = self::booking_form_submit($item_id);
         } else {
             $return = array('status' => false, 'message' => STTemplate::get_message_content());
             STTemplate::clear();
         }
     }
     echo json_encode($return);
     die;
 }
Example #13
0
 /**
  * @since 1.0.9
  * @update 1.1.3
  **/
 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = STInput::request('item_id', '');
     if ($item_id <= 0 || get_post_type($item_id) != 'st_cars') {
         STTemplate::set_message(__('This car is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $number = 1;
     // Validate required field
     if (!isset($_POST['booking_by']) || $_POST['booking_by'] != 'partner') {
         $change_location_date_box = $this->get_search_fields_box();
         $field_types = $this->get_search_fields_name();
         if (!empty($change_location_date_box)) {
             $message = '';
             foreach ($change_location_date_box as $key => $value) {
                 if (isset($field_types[$value['field_atrribute']]) and $value['is_required'] == 'on') {
                     $field_name = isset($field_types[$value['field_atrribute']]['field_name']) ? $field_types[$value['field_atrribute']]['field_name'] : false;
                     if ($field_name) {
                         if (is_array($field_name)) {
                             foreach ($field_name as $v) {
                                 if (!STInput::request($v)) {
                                     $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                                     $pass_validate = false;
                                 }
                             }
                         } elseif (is_string($field_name)) {
                             if (!STInput::request($field_name)) {
                                 $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                                 $pass_validate = false;
                             }
                         }
                     }
                 }
             }
             if ($message) {
                 $message = substr($message, 0, -4);
                 STTemplate::set_message($message, 'danger');
             }
         }
     }
     $check_in = '';
     $check_in_n = '';
     $check_in_time = '';
     if (isset($_REQUEST['pick-up-date']) && !empty($_REQUEST['pick-up-date'])) {
         $check_in = TravelHelper::convertDateFormat($_REQUEST['pick-up-date']);
         $check_in_n = $check_in;
     }
     if (isset($_REQUEST['pick-up-time']) && !empty($_REQUEST['pick-up-time'])) {
         $check_in .= ' ' . $_REQUEST['pick-up-time'];
         $check_in_time = $_REQUEST['pick-up-time'];
     }
     $check_in = date('Y-m-d H:i:s', strtotime($check_in));
     $check_out = '';
     $check_out_n = '';
     $check_out_time = '';
     if (isset($_REQUEST['drop-off-date']) && !empty($_REQUEST['drop-off-date'])) {
         $check_out = TravelHelper::convertDateFormat($_REQUEST['drop-off-date']);
         $check_out_n = $check_out;
     }
     if (isset($_REQUEST['drop-off-time']) && !empty($_REQUEST['drop-off-time'])) {
         $check_out .= ' ' . $_REQUEST['drop-off-time'];
         $check_out_time = $_REQUEST['drop-off-time'];
     }
     $check_out = date('Y-m-d H:i:s', strtotime($check_out));
     $location_id_pick_up = STInput::request('location_id_pick_up', '');
     $location_id_drop_off = STInput::request('location_id_drop_off', '');
     if (isset($_REQUEST['location_id_pick_up']) && !empty($_REQUEST['location_id_pick_up']) && isset($_REQUEST['location_id_drop_off']) && !empty($_REQUEST['location_id_drop_off'])) {
         $location_id_pick_up = intval(STInput::request('location_id_pick_up', '0'));
         $location_id_drop_off = intval(STInput::request('location_id_drop_off', '0'));
         $pickup_country = get_post_meta($location_id_pick_up, 'location_country', true);
         $dropoff_country = get_post_meta($location_id_drop_off, 'location_country', true);
         if (!$pickup_country) {
             STTemplate::set_message(__('The \'country\' field not set for the \'' . get_the_title($location_id_pick_up) . '\'', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if (!$dropoff_country) {
             STTemplate::set_message(__('The \'country\' field not set for \'' . get_the_title($location_id_drop_off) . '\'', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($pickup_country != $dropoff_country) {
             STTemplate::set_message(__('The country is not same', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
     }
     $today = date('m/d/Y');
     $booking_period = intval(get_post_meta($item_id, 'cars_booking_period', true));
     $booking_min_day = intval(get_post_meta($item_id, 'cars_booking_min_day', true));
     $booking_min_hour = intval(get_post_meta($item_id, 'cars_booking_min_hour', true));
     if (empty($booking_period) || $booking_period <= 0) {
         $booking_period = 0;
     }
     $check_in_timestamp = '';
     $check_out_timestamp = '';
     if (!empty($check_in_n) && !empty($check_out_n)) {
         $period = TravelHelper::dateDiff($today, $check_in_n);
         $compare = TravelHelper::dateCompare($today, $check_in_n);
         $check_in_timestamp = strtotime($check_in);
         $check_out_timestamp = strtotime($check_out);
         if ($check_in_timestamp - $check_out_timestamp >= 0) {
             STTemplate::set_message(__('The drop off datetime is later than the pick up datetime.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($compare < 0) {
             STTemplate::set_message(__('You can not set check-in date in the past', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($period < $booking_period) {
             STTemplate::set_message(sprintf(__('This car allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
             return false;
         }
         $unit = st()->get_option('cars_price_unit', 'day');
         if ($unit == 'day' and $booking_min_day and $booking_min_day > self::get_date_diff($check_in_timestamp, $check_out_timestamp)) {
             STTemplate::set_message(sprintf(__('Please booking at least %d day(s)', ST_TEXTDOMAIN), $booking_min_day), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($unit == 'hour' and $booking_min_hour and $booking_min_hour > self::get_date_diff($check_in_timestamp, $check_out_timestamp)) {
             STTemplate::set_message(sprintf(__('Please booking at least %d hour(s)', ST_TEXTDOMAIN), $booking_min_hour), 'danger');
             $pass_validate = false;
             return false;
         }
     }
     if ($check_in_timestamp > 0 && $check_out_timestamp > 0) {
         if (!CarHelper::_get_car_cant_order_by_id($item_id, $check_in_timestamp, $check_out_timestamp)) {
             STTemplate::set_message(__('This car is full order', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
     }
     $selected_equipments = json_decode(str_ireplace("\\", '', STInput::request('selected_equipments', '')));
     $info_price = STCars::get_info_price($item_id, strtotime($check_in), strtotime($check_out));
     $price_unit = $info_price['price'];
     $item_price = floatval(get_post_meta($item_id, 'cars_price', true));
     $price_equipment = STPrice::getPriceEuipmentCar($selected_equipments, $check_in_timestamp, $check_out_timestamp);
     $sale_price = STPrice::getSaleCarPrice($item_id, $item_price, strtotime($check_in), strtotime($check_out));
     $car_sale_price = STPrice::get_car_price_by_number_of_day_or_hour($item_id, $item_price, strtotime($check_in), strtotime($check_out));
     $discount_rate = STPrice::get_discount_rate($item_id, strtotime($check_in));
     $numberday = $numberday = STCars::get_date_diff(strtotime($check_in), strtotime($check_out), st()->get_option('cars_price_unit', 'day'));
     $data = array('check_in' => $check_in_n, 'check_out' => $check_out_n, 'check_in_time' => $check_in_time, 'check_out_time' => $check_out_time, 'check_in_timestamp' => strtotime($check_in), 'check_out_timestamp' => strtotime($check_out), 'location_id_pick_up' => $location_id_pick_up, 'location_id_drop_off' => $location_id_drop_off, 'pick_up' => get_the_title($location_id_pick_up), 'drop_off' => get_the_title($location_id_drop_off), 'ori_price' => $sale_price + $price_equipment, 'item_price' => $item_price, 'sale_price' => $car_sale_price, 'numberday' => $numberday, 'price_equipment' => $price_equipment, 'data_equipment' => $selected_equipments, 'commission' => TravelHelper::get_commission(), 'discount_rate' => $discount_rate);
     $pass_validate = apply_filters('st_car_add_cart_validate', $pass_validate, $item_id, $number, $price_unit, $data);
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $price_equipment + $sale_price, $data);
     }
     return $pass_validate;
 }
Example #14
0
            $_SESSION['bt_message']['type'] = $type;
        }
        public static function clear()
        {
            $_SESSION['bt_message'] = false;
        }
        public static function get_message()
        {
            return $_SESSION['bt_message'];
        }
        public static function get_message_content()
        {
            if (isset($_SESSION['bt_message']['content'])) {
                return $_SESSION['bt_message']['content'];
            }
        }
        public static function message()
        {
            $content = isset($_SESSION['bt_message']['content']) ? $_SESSION['bt_message']['content'] : false;
            $type = isset($_SESSION['bt_message']['type']) ? $_SESSION['bt_message']['type'] : false;
            if (!$content) {
                return;
            }
            $html = "<div class='alert alert-{$type}'>\r\n                <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"" . __('Close', ST_TEXTDOMAIN) . "\"><span aria-hidden=\"true\">&times;</span></button>\r\n                {$content}\r\n        </div>";
            //Reset Message
            $_SESSION['bt_message'] = array();
            return $html;
        }
    }
    STTemplate::init();
}
                                     </span>
                            <i class="fa fa-long-arrow-right"></i>
                        <?php 
/*} */
?>
                        <span class="text-lg">
                            <?php 
/*echo TravelHelper::format_money($price) */
?>
                        </span>
                    </p>
                    --><?php 
/*endif; */
?>
                    </p>
                </div>
            </div>
        </header>
        <?php 
$detail_layout = apply_filters('st_activity_detail_layout', st()->get_option('activity_layout'));
if ($detail_layout) {
    $content = STTemplate::get_vc_pagecontent($detail_layout);
    echo balanceTags($content);
} else {
    echo st()->load_template('activity/single', 'default');
}
?>
    </div>
</div>
<?php 
get_footer();
Example #16
0
remove_action('pre_get_posts', array($object, 'change_search_tour_arg'));
get_template_part('breadcrumb');
$result_string = '';
echo st()->load_template('search-loading');
?>
    <div class="mfp-with-anim mfp-dialog mfp-search-dialog mfp-hide" id="search-dialog">
        <?php 
echo st()->load_template('tours/search-form');
?>
    </div>
    <div class="container">
        <h3 class="booking-title"><?php 
echo balanceTags($object->get_result_string());
?>
            <small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out"><?php 
st_the_language('change_search');
?>
</a></small>
        </h3>
        <?php 
$tours_layout_layout = st()->get_option('tours_search_layout');
if (!empty($_REQUEST['layout_id'])) {
    $tours_layout_layout = $_REQUEST['layout_id'];
}
if ($tours_layout_layout) {
    echo STTemplate::get_vc_pagecontent($tours_layout_layout);
}
?>
    </div>
<?php 
get_footer();
                        <?php 
if ($fax = get_post_meta(get_the_ID(), 'fax', true)) {
    ?>
                            <li><a href="tel:<?php 
    echo str_replace(' ', '', trim($fax));
    ?>
"> <i class="fa fa-fax"></i> <?php 
    echo esc_html($fax);
    ?>
</a>
                            </li>
                        <?php 
}
?>
                    </ul>
                </div>

            </div>
        </header>
        <?php 
if ($detail_holiday_layout) {
    echo STTemplate::get_vc_pagecontent($detail_holiday_layout);
} else {
    //Default Layout
    echo st()->load_template('holidays/single', 'default');
}
?>
    </div><!-- End .booking-item-details-->
</div>
<?php 
get_footer();
Example #18
0
 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = STInput::request('item_id', '');
     if ($item_id <= 0 || get_post_type($item_id) != 'st_holidays') {
         STTemplate::set_message(__('This holiday is not available..', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $number = 1;
     $adult_number = intval(STInput::request('adult_number', 1));
     $child_number = intval(STInput::request('child_number', 0));
     $infant_number = intval(STInput::request('infant_number', 0));
     $data['adult_number'] = $adult_number;
     $data['child_number'] = $child_number;
     $data['infant_number'] = $infant_number;
     $max_number = intval(get_post_meta($item_id, 'max_people', true));
     $type_holiday = get_post_meta($item_id, 'type_holiday', true);
     $data['type_holiday'] = $type_holiday;
     $today = date('Y-m-d');
     $check_in = STInput::request('check_in', '');
     $check_out = STInput::request('check_out', '');
     if (!$check_in || !$check_out) {
         STTemplate::set_message(__('Select a holiday in the calendar above.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $compare = TravelHelper::dateCompare($today, $check_in);
     if ($compare < 0) {
         STTemplate::set_message(__('This holiday has expired', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $booking_period = intval(get_post_meta($item_id, 'holidays_booking_period', true));
     $period = TravelHelper::dateDiff($today, $check_in);
     if ($period < $booking_period) {
         STTemplate::set_message(sprintf(__('This holiday allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
         $pass_validate = false;
         return false;
     }
     if ($adult_number + $child_number + $infant_number > $max_number) {
         STTemplate::set_message(sprintf(__('Max of people for this holiday is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $holiday_available = HolidayHelper::checkAvailableHoliday($item_id, strtotime($check_in), strtotime($check_out));
     if (!$holiday_available) {
         STTemplate::set_message(__('The check in, check out day is not invalid or this holiday not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $free_people = intval(get_post_meta($item_id, 'max_people', true));
     $result = HolidayHelper::_get_free_peple($item_id, strtotime($check_in), strtotime($check_out));
     if (is_array($result) && count($result)) {
         $free_people = intval($result['free_people']);
     }
     if ($free_people < $adult_number + $child_number + $infant_number) {
         STTemplate::set_message(sprintf(__('This holiday only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $data_price = STPrice::getPriceByPeopleHoliday($item_id, strtotime($check_in), strtotime($check_out), $adult_number, $child_number, $infant_number);
     $total_price = $data_price['total_price'];
     $sale_price = STPrice::getSaleHolidaySalePrice($item_id, $total_price, $type_holiday, strtotime($check_in));
     $data['check_in'] = date('m/d/Y', strtotime($check_in));
     $data['check_out'] = date('m/d/Y', strtotime($check_out));
     $people_price = STPrice::getPeoplePrice($item_id, strtotime($check_in), strtotime($check_out));
     $data = wp_parse_args($data, $people_price);
     $data['ori_price'] = $sale_price;
     $data['currency'] = TravelHelper::get_current_currency('symbol');
     $data['currency_rate'] = TravelHelper::get_current_currency('rate');
     $data['currency_pos'] = TravelHelper::get_current_currency('booking_currency_pos');
     $data['commission'] = TravelHelper::get_commission();
     $data['data_price'] = $data_price;
     $data['discount_rate'] = STPrice::get_discount_rate($item_id, strtotime($check_in));
     if ($pass_validate) {
         $data['duration'] = $type_holiday == 'daily_holiday' ? floatval(get_post_meta($item_id, 'duration_day', true)) : '';
         if ($pass_validate) {
             STCart::add_cart($item_id, $number, $sale_price, $data);
         }
     }
     return $pass_validate;
 }
Example #19
0
 /**
  *  引入文件 include 语法处理
  *
  * @access    public
  * @param     string  $filename  文件名
  * @param     string  $isload  是否载入
  * @return    string
  */
 function CompilerInclude($filename, $isload = TRUE)
 {
     $okfile = '';
     if (@file_exists($filename)) {
         $okfile = $filename;
     } else {
         if (@file_exists($this->refDir . $filename)) {
             $okfile = $this->refDir . $filename;
         } else {
             if (@file_exists($this->refDir . "../" . $filename)) {
                 $okfile = $this->refDir . "../" . $filename;
             }
         }
     }
     if ($okfile == '') {
         return 0;
     }
     if (!$isload) {
         return 1;
     }
     $itpl = new STTemplate($this->templateDir);
     $itpl->isCache = $this->isCache;
     $itpl->SetObject($this->refObj);
     $itpl->LoadTemplate($okfile);
     return $itpl->CacheFile();
 }
?>
<div id="single-room"  class="booking-item-details">
    <div class="thumb">
        <a href="javascript:;" id="fancy-gallery">
            <?php 
if (has_post_thumbnail() and get_the_post_thumbnail()) {
    the_post_thumbnail(array(1600, 500), array('class' => 'fancy-responsive'));
} else {
    echo "<img src='" . get_template_directory_uri() . '/img/default/1600x500.png' . "' class='fancy-responsive' alt='" . get_the_title() . "'>";
}
?>
        </a>
    </div>
	<?php 
if ($layout && !empty($layout)) {
    echo STTemplate::get_vc_pagecontent($layout);
} else {
    echo do_shortcode('
                [vc_row el_class="custom-row-single-room"][vc_column width="2/3"][st_hotel_room_header][st_hotel_room_facility facility_des=""][st_hotel_room_calendar][st_hotel_room_gallery style="slide"][/vc_column][vc_column width="1/3" el_class="custom-row-single-room"][st_hotel_room_sidebar][/vc_column][/vc_row][vc_row][vc_column css=".vc_custom_1435226180968{margin-top: 20px !important;}"][vc_column_text]
<h4 class="booking-item-title text-color">Reviews</h4>
[/vc_column_text][st_hotel_room_review][/vc_column][/vc_row][vc_row row_fullwidth="yes" el_class="ov-h" css=".vc_custom_1436947692102{padding-right: 0px !important;padding-left: 0px !important;}"][vc_column css=".vc_custom_1436946930085{padding-top: 50px !important;padding-right: 0px !important;padding-left: 0px !important;}"][st_room_map show_circle="yes" zoom="13"][/vc_column][/vc_row]
            ');
}
?>
</div>
<?php 
if (is_array($fancy_arr) && count($fancy_arr)) {
    ?>
    <script>
        jQuery(document).ready(function($) {
            $('a#fancy-gallery').click(function(event) {
Example #21
0
 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = STInput::request('item_id');
     $number = STInput::request('number');
     $discount = STInput::request('discount');
     $price = STInput::request('price');
     if (!empty($discount)) {
         $price_sale = $price - $price * ($discount / 100);
         $data = array('discount' => $discount, 'price_sale' => $price_sale);
     }
     $data['check_in'] = STInput::request('check_in');
     $data['check_out'] = STInput::request('check_out');
     $data['type_tour'] = STInput::request('type_tour');
     $data['type_price'] = STInput::request('type_price');
     if ($data['type_price'] == 'people_price') {
         $prices = self::get_price_person($item_id);
         $data['adult_price'] = $prices['adult'];
         $data['child_price'] = $prices['child'];
         $data['discount'] = $prices['discount'];
         $data['adult_number'] = STInput::request('adult_number', 1);
         $data['child_number'] = STInput::request('children_number', 0);
     }
     $data['duration'] = STInput::request('duration');
     $type_tour = STInput::request('type_tour');
     $today = strtotime(date('m/d/Y', time()));
     if ($type_tour == 'daily_tour') {
         $check_in = strtotime(TravelHelper::convertDateFormat(STInput::request('check_in')));
     } else {
         $check_in = strtotime(get_post_meta($item_id, 'check_in', true));
     }
     $booking_period = intval(get_post_meta($item_id, 'tours_booking_period', true));
     $period = STDate::date_diff($today, $check_in);
     $expired = $check_in - $today;
     if ($type_tour == 'daily_tour') {
         if ($booking_period && $period < $booking_period) {
             STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
             return;
         }
     } else {
         if ($expired < 0) {
             STTemplate::set_message(__('This tour has expired', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return;
         }
     }
     if ($pass_validate) {
         $pass_validate = apply_filters('st_tour_add_cart_validate', $pass_validate, $data);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $price, $data);
     }
     return $pass_validate;
 }
Example #22
0
<div class="st-create">
    <h2 class="pull-left"><?php 
_e("Edit Hotel", ST_TEXTDOMAIN);
?>
</h2>
    <a target="_blank" href="<?php 
echo get_the_permalink($post_id);
?>
" class="btn btn-default pull-right"><?php 
_e("Preview", ST_TEXTDOMAIN);
?>
</a>
</div>
<div class="msg">
    <?php 
echo STTemplate::message();
?>
    <?php 
echo STUser_f::get_msg();
?>
</div>
<form action="" method="post" enctype="multipart/form-data" id="st_form_add_partner">
    <?php 
wp_nonce_field('user_setting', 'st_update_post_hotel');
?>
    <div class="form-group form-group-icon-left">
        
        <label for="title" class="head_bol"><?php 
echo __('Name of Hotel', ST_TEXTDOMAIN);
?>
:</label>
Example #23
0
 function do_add_to_cart()
 {
     $pass_validate = TRUE;
     $item_id = intval(STInput::request('item_id', ''));
     if ($item_id <= 0 || get_post_type($item_id) != 'st_hotel') {
         STTemplate::set_message(__('This hotel is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $room_id = intval(STInput::request('room_id', ''));
     if ($room_id <= 0 || get_post_type($room_id) != 'hotel_room') {
         STTemplate::set_message(__('This room is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $check_in = STInput::request('check_in', '');
     if (empty($check_in)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $check_in = TravelHelper::convertDateFormat($check_in);
     $check_out = STInput::request('check_out', '');
     if (empty($check_out)) {
         STTemplate::set_message(__('Date is invalid', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $check_out = TravelHelper::convertDateFormat($check_out);
     $room_num_search = intval(STInput::request('room_num_search', ''));
     if ($room_num_search <= 0) {
         $room_num_search = 1;
     }
     $adult_number = intval(STInput::request('adult_number', ''));
     if ($adult_number <= 0) {
         $adult_number = 1;
     }
     $child_number = intval(STInput::request('child_number', ''));
     if ($child_number <= 0) {
         $child_number = 0;
     }
     $checkin_ymd = date('Y-m-d', strtotime($check_in));
     $checkout_ymd = date('Y-m-d', strtotime($check_out));
     if (!HotelHelper::check_day_cant_order($room_id, $checkin_ymd, $checkout_ymd, $room_num_search)) {
         STTemplate::set_message(sprintf(__('This room is not available from %s to %s.', ST_TEXTDOMAIN), $checkin_ymd, $checkout_ymd), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if (!HotelHelper::_check_room_available($room_id, $checkin_ymd, $checkout_ymd, $room_num_search)) {
         STTemplate::set_message(__('This room is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if (strtotime($check_out) - strtotime($check_in) <= 0) {
         STTemplate::set_message(__('The check-out is later than the check-in.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $num_room = intval(get_post_meta($room_id, 'number_room', true));
     $adult = intval(get_post_meta($room_id, 'adult_number', true));
     $children = intval(get_post_meta($room_id, 'children_number', true));
     if ($room_num_search > $num_room) {
         STTemplate::set_message(__('Max of rooms are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($adult_number > $adult) {
         STTemplate::set_message(sprintf(__('Max of adults is %d people.', ST_TEXTDOMAIN), $adult), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($child_number > $children) {
         STTemplate::set_message(__('Number of children in the room are incorrect.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $today = date('m/d/Y');
     $period = TravelHelper::dateDiff($today, $check_in);
     $booking_min_day = intval(get_post_meta($item_id, 'min_book_room', true));
     $compare = TravelHelper::dateCompare($today, $check_in);
     $booking_period = get_post_meta($item_id, 'hotel_booking_period', true);
     if (empty($booking_period) || $booking_period <= 0) {
         $booking_period = 0;
     }
     if ($compare < 0) {
         STTemplate::set_message(__('You can not set check-in date in the past', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($period < $booking_period) {
         STTemplate::set_message(sprintf(__('This hotel allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($booking_min_day and $booking_min_day > TravelHelper::dateDiff($check_in, $check_out)) {
         STTemplate::set_message(sprintf(__('Please booking at least %d day(s)', ST_TEXTDOMAIN), $booking_min_day), 'danger');
         $pass_validate = false;
         return false;
     }
     $item_price = floatval(get_post_meta($room_id, 'price', true));
     // Extra price added in the new version 1.1.9
     $extras = STInput::request('extra_price', array());
     $numberday = TravelHelper::dateDiff($check_in, $check_out);
     $extra_price = STPrice::getExtraPrice($extras, $room_num_search, $numberday);
     $sale_price = STPrice::getRoomPrice($room_id, strtotime($check_in), strtotime($check_out), $room_num_search);
     $discount_rate = STPrice::get_discount_rate($room_id, strtotime($check_in));
     $data = array('item_price' => $item_price, 'ori_price' => $sale_price + $extra_price, 'check_in' => $check_in, 'check_out' => $check_out, 'room_num_search' => $room_num_search, 'room_id' => $room_id, 'adult_number' => $adult_number, 'child_number' => $child_number, 'extras' => $extras, 'extra_price' => $extra_price, 'commission' => TravelHelper::get_commission(), 'discount_rate' => $discount_rate);
     if ($pass_validate) {
         $pass_validate = apply_filters('st_hotel_add_cart_validate', $pass_validate, $data);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $room_num_search, $sale_price + $extra_price, $data);
     }
     return $pass_validate;
 }
/*
Template Name: Confirm Order
*/
/**
 * @package WordPress
 * @subpackage Traveler
 * @since 1.0
 *
 * Template Name : confirm
 *
 * Created by ShineTheme
 *
 */
get_header();
$message = STTemplate::get_message();
?>
<div class="gap"></div>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <?php 
if ($message['type']) {
    ?>
            <i class="fa fa-check round box-icon-large box-icon-center box-icon-success mb30"></i>
            <?php 
} else {
    ?>
                <i class="fa fa-close round box-icon-large box-icon-center box-icon-danger mb30"></i>
            <?php 
}
Example #25
0
 * @since 1.0
 *
 * Footer
 *
 * Created by ShineTheme
 *
 */
$footer_template = st()->get_option('footer_template');
if (is_singular()) {
    if ($meta = get_post_meta(get_the_ID(), 'footer_template', true)) {
        $footer_template = $meta;
    }
}
if ($footer_template) {
    echo '<footer id="main-footer">';
    echo STTemplate::get_vc_pagecontent($footer_template);
    echo ' </footer>';
} else {
    ?>
<!--        Default Footer -->
    <footer id="main-footer">
        <div class="container text-center">
            <p><?php 
    _e('Copy &copy; 2014 Shinetheme. All Rights Reserved', ST_TEXTDOMAIN);
    ?>
</p>
        </div>

    </footer>
<?php 
}