if ($cruise_locations && count($cruise_locations) > 0) { ?> <!--locations--> <section id="locations" class="tab-content <?php echo $first_display_tab == 'locations' ? 'initial' : ''; ?> "> <article> <?php do_action('byt_show_single_cruise_locations_before'); ?> <?php foreach ($cruise_locations as $location_id) { $location_obj = new byt_location((int) $location_id); $location_title = $location_obj->get_title(); $location_excerpt = $location_obj->get_excerpt(); if (!empty($location_title) && !empty($location_excerpt)) { BYT_Theme_Utils::render_field("", "", "", BYT_Theme_Utils::render_image('', '', $location_obj->get_main_image(), $location_title, $location_title, false) . $location_excerpt, $location_title); BYT_Theme_Utils::render_link_button(get_permalink($location_obj->get_id()), "gradient-button right", "", __('Read more', 'bookyourtravel')); } } ?> <?php BYT_Theme_Utils::render_tab_extra_fields('cruise_extra_fields', $cruise_extra_fields, 'locations', $cruise_obj); ?> <?php do_action('byt_show_single_cruise_locations_after'); ?>
function book_car_rental_ajax_request() { global $byt_car_rentals_post_type, $byt_theme_globals, $byt_theme_woocommerce; $enc_key = $byt_theme_globals->get_enc_key(); $add_captcha_to_forms = $byt_theme_globals->add_captcha_to_forms(); if (isset($_REQUEST)) { $nonce = $_REQUEST['nonce']; if (wp_verify_nonce($nonce, 'byt-ajax-nonce')) { $first_name = isset($_REQUEST['first_name']) ? wp_kses($_REQUEST['first_name'], '') : ''; $last_name = isset($_REQUEST['last_name']) ? wp_kses($_REQUEST['last_name'], '') : ''; $email = isset($_REQUEST['email']) ? wp_kses($_REQUEST['email'], '') : ''; $phone = isset($_REQUEST['phone']) ? wp_kses($_REQUEST['phone'], '') : ''; $address = isset($_REQUEST['address']) ? wp_kses($_REQUEST['address'], '') : ''; $town = isset($_REQUEST['town']) ? wp_kses($_REQUEST['town'], '') : ''; $zip = isset($_REQUEST['zip']) ? wp_kses($_REQUEST['zip'], '') : ''; $country = isset($_REQUEST['country']) ? wp_kses($_REQUEST['country'], '') : ''; $special_requirements = isset($_REQUEST['requirements']) ? wp_kses($_REQUEST['requirements'], '') : ''; $date_from = isset($_REQUEST['date_from']) ? wp_kses($_REQUEST['date_from'], '') : ''; $date_from = date('Y-m-d', strtotime($date_from)); $date_to = isset($_REQUEST['date_to']) ? wp_kses($_REQUEST['date_to'], '') : ''; $date_to = date('Y-m-d', strtotime($date_to)); $car_rental_id = isset($_REQUEST['car_rental_id']) ? intval(wp_kses($_REQUEST['car_rental_id'], '')) : 0; $drop_off = isset($_REQUEST['drop_off']) ? intval(wp_kses($_REQUEST['drop_off'], '')) : ''; $c_val_s = isset($_REQUEST['c_val_s']) ? intval(wp_kses($_REQUEST['c_val_s'], '')) : 0; $c_val_1 = isset($_REQUEST['c_val_1']) ? intval(BYT_Theme_Utils::decrypt(wp_kses($_REQUEST['c_val_1'], ''), $enc_key)) : 0; $c_val_2 = isset($_REQUEST['c_val_2']) ? intval(BYT_Theme_Utils::decrypt(wp_kses($_REQUEST['c_val_2'], ''), $enc_key)) : 0; // nonce passed ok $car_rental_obj = new byt_car_rental($car_rental_id); if ($car_rental_obj != null) { if ($add_captcha_to_forms && $c_val_s != $c_val_1 + $c_val_2) { echo 'captcha_error'; die; } else { $drop_off_location_obj = new byt_location($drop_off); $drop_off_location_title = $drop_off_location_obj->get_title(); $car_rental_location = $car_rental_obj->get_location(); $pick_up_location_title = ''; if ($car_rental_location) { $pick_up_location_title = $car_rental_location->get_title(); } $price_per_day = floatval($car_rental_obj->get_custom_field('price_per_day')); $datediff = strtotime($date_to) - strtotime($date_from); $days = floor($datediff / (60 * 60 * 24)); $total_price = $price_per_day * $days; $current_user = wp_get_current_user(); $booking_id = $byt_car_rentals_post_type->create_car_rental_booking($first_name, $last_name, $email, $phone, $address, $town, $zip, $country, $special_requirements, $date_from, $date_to, $car_rental_id, $current_user->ID, $total_price, $drop_off); $is_reservation_only = get_post_meta($car_rental_id, 'car_rental_is_reservation_only', true); $use_woocommerce_for_checkout = $byt_theme_globals->use_woocommerce_for_checkout(); if (BYT_Theme_Utils::is_woocommerce_active() && !$is_reservation_only) { if ($use_woocommerce_for_checkout) { $product_id = $byt_theme_woocommerce->woocommerce_create_product($car_rental_obj->get_title(), '', 'ACC_' . $car_rental_id . '_', $booking_id, $total_price, BOOKYOURTRAVEL_WOO_PRODUCT_CAT_CAR_RENTALS); echo $product_id; } } else { echo $booking_id; } if (!$use_woocommerce_for_checkout || !BYT_Theme_Utils::is_woocommerce_active()) { // only send email if we are not proceeding to WooCommerce checkout or if woocommerce is not active at all. $admin_email = get_bloginfo('admin_email'); $admin_name = get_bloginfo('name'); $headers = "From: {$admin_name} <{$admin_email}>\n"; $subject = __('New car rental booking', 'bookyourtravel'); $message = __("New car rental booking: \n\nFirst name: %s \n\nLast name: %s \n\nEmail: %s \n\nPhone: %s \n\nAddress: %s \n\nTown: %s \n\nZip: %s \n\nCountry: %s \n\nSpecial requirements: %s \n\nDate from: %s \n\nDate to: %s \n\nPick up: %s \n\nDrop off: %s \n\nTotal price: %d \n\nCar: %s \n", 'bookyourtravel'); $message = sprintf($message, $first_name, $last_name, $email, $phone, $address, $town, $zip, $country, $special_requirements, $date_from, $date_to, $pick_up_location_title, $drop_off_location_title, $total_price, $car_rental_obj->get_title()); wp_mail($email, $subject, $message, $headers); $contact_email = get_post_meta($car_rental_id, 'car_rental_contact_email', true); $contact_emails = explode(';', $contact_email); if (empty($contact_email)) { $contact_emails = array($admin_email); } foreach ($contact_emails as $e) { if (!empty($e)) { wp_mail($e, $subject, $message, $headers); } } } } } } } // Always die in functions echoing ajax content die; }
global $post, $location_class, $display_mode, $byt_theme_globals, $byt_locations_post_type, $byt_accommodations_post_type, $byt_tours_post_type, $byt_cruises_post_type, $byt_car_rentals_post_type; $enable_accommodations = $byt_theme_globals->enable_accommodations(); $enable_cruises = $byt_theme_globals->enable_cruises(); $enable_tours = $byt_theme_globals->enable_tours(); $enable_car_rentals = $byt_theme_globals->enable_car_rentals(); $price_decimal_places = $byt_theme_globals->get_price_decimal_places(); $default_currency_symbol = $byt_theme_globals->get_default_currency_symbol(); $show_currency_symbol_after = $byt_theme_globals->show_currency_symbol_after(); $show_self_catered_count_in_location_items = $byt_theme_globals->show_self_catered_count_in_location_items(); $show_hotel_count_in_location_items = $byt_theme_globals->show_hotel_count_in_location_items(); $show_cruise_count_in_location_items = $byt_theme_globals->show_cruise_count_in_location_items(); $show_tour_count_in_location_items = $byt_theme_globals->show_tour_count_in_location_items(); $show_car_rental_count_in_location_items = $byt_theme_globals->show_car_rental_count_in_location_items(); $location_id = $post->ID; $location_obj = new byt_location($post); $base_id = $location_obj->get_base_id(); $location_image = $location_obj->get_main_image(); if (empty($location_image)) { $location_image = BYT_Theme_Utils::get_file_uri('/images/uploads/img.jpg'); } $hotel_count = $self_catered_count = $cruise_count = $tour_count = $car_rental_count = 0; if ($show_hotel_count_in_location_items) { $hotel_count = (int) $byt_accommodations_post_type->list_accommodations_count(0, -1, 'post_title', 'ASC', $location_id, array(), array(), array(), false, false); } if ($show_self_catered_count_in_location_items) { $self_catered_count = (int) $byt_accommodations_post_type->list_accommodations_count(0, -1, 'post_title', 'ASC', $location_id, array(), array(), array(), false, true); } if ($show_cruise_count_in_location_items) { $cruise_count = (int) $byt_cruises_post_type->list_cruises_count(0, -1, 'post_title', 'ASC', $location_id); }
get_header(); BYT_Theme_Utils::breadcrumbs(); get_sidebar('under-header'); global $post, $current_user, $byt_theme_globals, $byt_theme_of_custom, $byt_accommodations_post_type, $byt_cruises_post_type, $byt_tours_post_type, $byt_car_rentals_post_type, $default_location_tabs; $enable_accommodations = $byt_theme_globals->enable_accommodations(); $enable_cruises = $byt_theme_globals->enable_cruises(); $enable_car_rentals = $byt_theme_globals->enable_car_rentals(); $enable_tours = $byt_theme_globals->enable_tours(); $price_decimal_places = $byt_theme_globals->get_price_decimal_places(); $location_extra_fields = $byt_theme_globals->get_location_extra_fields(); $tab_array = $byt_theme_globals->get_location_tabs(); if (have_posts()) { the_post(); $location_id = $post->ID; $location_obj = new byt_location($post); $display_as_directory = $location_obj->get_custom_field('display_as_directory'); if (!$display_as_directory) { ?> <!--three-fourth content--> <section class="three-fourth"> <h1><?php echo $location_obj->get_title(); ?> </h1> <?php $location_obj->render_image_gallery(); ?> <!--inner navigation--> <nav class="inner-nav"> <ul>