Changeset 2742744
- Timestamp:
- 06/15/2022 09:24:07 AM (3 years ago)
- Location:
- tourfic/trunk
- Files:
-
- 6 added
- 1 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
tourfic/trunk/admin/assets/css/admin.css
r2715192 r2742744 1 /** 2 * Common 3 */ 4 .tf-post-states{ 5 display: inline-block; 6 font-size: 11px; 7 padding: 1px 8px; 8 border-radius: 10px; 9 background: #333; 10 color: #fff; 11 } 12 1 13 /** 2 14 * Meta field … … 40 52 .tf-csf-badge .tf-pro { 41 53 background: #b30000; 54 } 55 56 /** 57 * Hotel 58 */ 59 .room-repeater .unique-id, 60 .room-repeater .tf-order_id { 61 display: none; 42 62 } 43 63 … … 114 134 display: none !important; 115 135 } 136 /** 137 * Override Codestar repeater for Hotel Room 138 */ 139 .csf-section .room-repeater > .csf-title{ 140 width: 100%; 141 margin: 0 0 20px 0; 142 font-size: 18px; 143 } 144 .csf-section .room-repeater > .csf-fieldset{ 145 width: 100%; 146 } 147 .csf-section .room-repeater .csf-repeater-wrapper .csf-repeater-item { 148 margin: 0 0 20px 0; 149 border-bottom: 2px solid #2271b1; 150 } 151 152 .csf-section .room-repeater .repeater-by-date > .csf-title{ 153 display: none; 154 } 155 .csf-section .room-repeater .repeater-by-date > .csf-fieldset{ 156 width: 100%; 157 } 158 .csf-section .room-repeater .repeater-by-date .csf-repeater-wrapper .csf-repeater-item { 159 margin: 0 0 20px 0; 160 border-bottom: 1px solid #eee; 161 } 162 163 /** 164 * Change admin menu color 165 */ 166 #adminmenu .toplevel_page_tourfic .dashicons-before:before { 167 color: #8bc34a; 168 } 169 #adminmenu .menu-icon-tf_hotel .dashicons-before:before { 170 color: #03a9f4; 171 } 172 #adminmenu .menu-icon-tf_tours .dashicons-before:before { 173 color: #ffc107; 174 } -
tourfic/trunk/admin/assets/js/admin.js
r2715192 r2742744 13 13 }, 14 14 }); 15 15 16 /** 16 17 18 17 * Delete old review fields 18 * @author kabir, fida 19 */ 19 20 $(document).on('click', '.tf-del-old-review-fields', function (e) { 20 21 e.preventDefault(); … … 42 43 43 44 }); 45 46 /** 47 * Delete room order ids 48 * @author fida 49 */ 50 $(document).on('click', '.remove-order-ids', function (e) { 51 52 e.preventDefault(); 53 54 var $this = $(this); 55 var meta_field = $this.closest( '.csf-repeater-content' ).find('.tf-order_id input').attr('name'); 56 57 var data = { 58 action: 'tf_remove_room_order_ids', 59 meta_field: meta_field, 60 post_id: post_id, 61 }; 62 63 $.ajax({ 64 type: 'post', 65 url: ajaxurl, 66 data: data, 67 beforeSend: function (data) { 68 notyf.success('Deleting order ids...') 69 }, 70 success: function (data) { 71 notyf.success(data.data); 72 location.reload(); 73 }, 74 error: function (data) { 75 notyf.error(data.data); 76 }, 77 }); 78 79 }); 80 44 81 /** 45 82 * Tour location required … … 103 140 }); 104 141 142 /** 143 * Generate & set unique id for hotel rooms 144 */ 145 $(document).on('click', '.room-repeater > div.csf-fieldset > a.csf-repeater-add', function(e) { 146 147 var repeaterNumber = $('.room-repeater .csf-repeater-wrapper [data-depend-id="room"]').length - 2; 148 149 $('.room-repeater .unique-id input').each(function() { 150 repeaterNumber++; 151 if( $('.room-repeater [data-depend-id="room"] [data-depend-id="unique_id"]').val().length === 0 ) { 152 $('.room-repeater [name="tf_hotel[room]['+repeaterNumber+'][unique_id]"]').val(new Date().valueOf() + repeaterNumber); 153 } 154 }); 155 156 }); 157 105 158 }); 106 159 -
tourfic/trunk/admin/inc/functions.php
r2715192 r2742744 19 19 'tf_hotel' => array( 20 20 'hotel_location' => array( 21 'message' => 'Please select a location before publishing this hotel.'21 'message' => __( 'Please select a location before publishing this hotel', 'tourfic' ) 22 22 ) 23 23 ), 24 24 'tf_tours' => array( 25 25 'tour_destination' => array( 26 'message' => 'Please select a destination before publishing this tour.'27 28 ), 26 'message' => __( 'Please select a destination before publishing this tour', 'tourfic' ) 27 ) 28 ) 29 29 ); 30 30 … … 93 93 94 94 if ( $tf_is_gutenberg_active ) { 95 95 96 wp_enqueue_script( 'tf-required', TF_ADMIN_URL . 'assets/js/required-taxonomies-gutenberg.js', array( 96 97 'jquery', 'wp-data', 'wp-editor', 'wp-edit-post' 97 98 )); 99 98 100 } else { 101 99 102 wp_enqueue_script( 'tf-required', TF_ADMIN_URL . 'assets/js/required-taxonomies.js', array( 'jquery' ), false, true ); 103 100 104 } 101 105 … … 111 115 112 116 function tf_is_gutenberg_active() { 113 if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page()) {117 if ( function_exists( 'is_gutenberg_page' ) ) { 114 118 return true; 115 119 } … … 126 130 } 127 131 132 /** 133 * Get post id 134 */ 135 function tf_admin_footer() { 136 137 $screen = get_current_screen(); 138 139 if ( is_admin() && ($screen->id == 'tf_hotel') ) { 140 global $post; 141 ?> 142 <script> 143 var post_id = '<?php echo $post->ID; ?>'; 144 </script> 145 <?php 146 } 147 } 148 add_action( 'admin_footer', 'tf_admin_footer' ); 128 149 ?> -
tourfic/trunk/admin/options/global/parts/search.php
r2696074 r2742744 2 2 // don't load directly 3 3 defined( 'ABSPATH' ) || exit; 4 5 $badge_pro = '<div class="tf-csf-badge"><span class="tf-pro">' .__("Pro Feature", "tourfic"). '</span></div>'; 4 6 5 7 CSF::createSection( $prefix, array( … … 9 11 'fields' => array( 10 12 11 array( 12 'id' => 'search-result-page', 13 'type' => 'select', 14 'placeholder' => __('Select a page', 'tourfic' ), 15 'chosen' => true, 16 'ajax' => true, 17 'title' => __( 'Select Search Result Page', 'tourfic' ), 18 'desc' => __( 'Page template: <code>Tourfic - Search Result</code> must be selected', 'tourfic' ), 19 'options' => 'pages', 20 21 ), 22 array( 23 'id' => 'search_relation', 24 'type' => 'select', 25 'title' => __( 'Search Result Relation', 'tourfic' ), 26 'desc' => __( 'Search result relation with search widget and filters. OR means matched any query, AND means matched all query.', 'tourfic' ), 27 'chosen' => true, 28 'placeholder' => __('Select an option', 'tourfic' ), 29 'options' => array( 30 'AND' => 'AND', 31 'OR' => 'OR', 13 array( 14 'id' => 'search-result-page', 15 'type' => 'select', 16 'placeholder' => __('Select a page', 'tourfic' ), 17 'chosen' => true, 18 'ajax' => true, 19 'title' => __( 'Select Search Result Page', 'tourfic' ), 20 'desc' => __( 'Page template: <code>Tourfic - Search Result</code> must be selected', 'tourfic' ), 21 'options' => 'pages', 22 32 23 ), 33 'default' => 'AND' 34 ), 24 25 array( 26 'id' => 'date_hotel_search', 27 'class' => 'tf-csf-disable tf-csf-pro', 28 'type' => 'switcher', 29 'title' => __('Date Required in Hotel Search', 'tourfic'), 30 'subtitle' => $badge_pro, 31 'text_on' => __('Yes', 'tourfic'), 32 'text_off' => __('No', 'tourfic'), 33 ), 34 35 array( 36 'id' => 'date_tour_search', 37 'class' => 'tf-csf-disable tf-csf-pro', 38 'type' => 'switcher', 39 'title' => __('Date Required in Tour Search', 'tourfic'), 40 'subtitle' => $badge_pro, 41 'text_on' => __('Yes', 'tourfic'), 42 'text_off' => __('No', 'tourfic'), 43 ), 35 44 36 45 ) -
tourfic/trunk/admin/options/global/parts/vendor.php
r2696074 r2742744 33 33 array( 34 34 'type' => 'content', 35 'content' => __('Use shortcode <code>[tf_registration_form]</code> to show registration form in post/page .', 'tourfic' ),35 'content' => __('Use shortcode <code>[tf_registration_form]</code> to show registration form in post/page/widget.', 'tourfic' ), 36 36 ), 37 37 … … 53 53 'dependency' => array( 'email-verify', '==', 'true' ), 54 54 'default' => true, 55 ), 56 57 array( 58 'type' => 'content', 59 'content' => __('Use shortcode <code>[tf_login_form]</code> to show login form in post/page/widget.', 'tourfic' ), 55 60 ), 56 61 -
tourfic/trunk/admin/options/hotel/single-hotel.php
r2715192 r2742744 2 2 defined( 'ABSPATH' ) || exit; 3 3 4 $badge_up = '<div class="tf-csf-badge"><span class="tf-upcoming">' .__("Upcoming", "tourfic"). '</span></div>';5 $badge_pro = '<div class="tf-csf-badge"><span class="tf-pro">' .__("Pro Feature", "tourfic"). '</span></div>';4 $badge_up = '<div class="tf-csf-badge"><span class="tf-upcoming">' .__("Upcoming", "tourfic"). '</span></div>'; 5 $badge_pro = '<div class="tf-csf-badge"><span class="tf-pro">' .__("Pro Feature", "tourfic"). '</span></div>'; 6 6 $badge_up_pro = '<div class="tf-csf-badge"><span class="tf-upcoming">' .__("Upcoming", "tourfic"). '</span><span class="tf-pro">' .__("Pro Feature", "tourfic"). '</span></div>'; 7 7 … … 25 25 26 26 array( 27 'id' => 'address',28 'type' => 'textarea',29 'title' => __('Hotel Address', 'tourfic'),30 'subtitle' => __('Enter hotel adress', 'tourfic'),27 'id' => 'address', 28 'type' => 'textarea', 29 'title' => __('Hotel Address', 'tourfic'), 30 'subtitle' => __('Enter hotel adress', 'tourfic'), 31 31 'placeholder' => __('Address', 'tourfic'), 32 'attributes' => array(32 'attributes' => array( 33 33 'required' => 'required', 34 34 ), … … 37 37 array( 38 38 'id' => '', 39 'class' => 'tf-csf-disable tf-csf-pro',39 'class' => 'tf-csf-disable tf-csf-pro', 40 40 'type' => 'map', 41 41 'title' => __('Location on Map', 'tourfic'), … … 56 56 57 57 array( 58 'id' => 'gallery',59 'type' => 'gallery',60 'title' => __('Hotel Gallery', 'tourfic'),58 'id' => 'gallery', 59 'type' => 'gallery', 60 'title' => __('Hotel Gallery', 'tourfic'), 61 61 'subtitle' => __('Upload one or many images to make a hotel image gallery for customers', 'tourfic'), 62 62 ), 63 63 64 64 array( 65 'id' => 'featured',66 'class' => 'tf-csf-disable',67 'type' => 'switcher',68 'title' => __('Featured Hotel', 'tourfic' ),69 'subtitle' 65 'id' => 'featured', 66 'class' => 'tf-csf-disable', 67 'type' => 'switcher', 68 'title' => __('Featured Hotel', 'tourfic' ), 69 'subtitle' => $badge_up, 70 70 'text_on' => __('Yes', 'tourfic' ), 71 71 'text_off' => __('No', 'tourfic' ), … … 84 84 array( 85 85 'id' => '', 86 'class' => 'tf-csf-disable tf-csf-pro',86 'class' => 'tf-csf-disable tf-csf-pro', 87 87 'type' => 'text', 88 88 'title' => __('Hotel Video', 'tourfic'), 89 'subtitle' 90 'desc' =>__( 'Enter YouTube/Vimeo URL here', 'tourfic' ),89 'subtitle' => $badge_up_pro, 90 'desc' => __( 'Enter YouTube/Vimeo URL here', 'tourfic' ), 91 91 'validate' => 'csf_validate_url', 92 92 ), … … 157 157 158 158 array( 159 'id' => '',160 'class' => 'tf-csf-disable tf-csf-pro',161 'type' => 'switcher',162 'title' => __('Allowed Full Day Booking', 'tourfic'),163 'subtitle' => 164 'desc' =>__( 'E.g: booking from 22 -23, then all days 22 and 23 are full, other people cannot book', 'tourfic' ),159 'id' => '', 160 'class' => 'tf-csf-disable tf-csf-pro', 161 'type' => 'switcher', 162 'title' => __('Allowed Full Day Booking', 'tourfic'), 163 'subtitle' => __( 'You can book room with full day' .$badge_up_pro, 'tourfic' ), 164 'desc' => __( 'E.g: booking from 22 -23, then all days 22 and 23 are full, other people cannot book', 'tourfic' ), 165 165 ), 166 166 … … 199 199 200 200 array( 201 'id' => 'room', 202 'type' => 'repeater', 203 'title' => __('Room Details', 'tourfic' ), 204 'max' => 5, 205 'fields' => array( 201 'id' => 'room', 202 'class' => 'room-repeater', 203 'type' => 'repeater', 204 'title' => __('Room Details', 'tourfic' ), 205 'button_title' => __('Add New Room', 'tourfic'), 206 'max' => 5, 207 'fields' => array( 206 208 209 array( 210 'id' => 'unique_id', 211 'class' => 'unique-id', 212 'type' => 'text', 213 'title' => __('Unique ID', 'tourfic' ), 214 'attributes' => array( 215 'readonly' => 'readonly', 216 ), 217 ), 218 219 array( 220 'id' => 'order_id', 221 'class' => 'tf-order_id', 222 'type' => 'text', 223 'title' => __('Order ID', 'tourfic' ), 224 'attributes' => array( 225 'readonly' => 'readonly', 226 ), 227 ), 228 207 229 array( 208 230 'id' => 'enable', … … 223 245 224 246 array( 225 'id' => 'num-room', 226 'type' => 'number', 227 'title' => __('Number of Rooms', 'tourfic' ), 228 'subtitle' => __( 'Number of available rooms for booking', 'tourfic' ), 247 'id' => 'num-room', 248 'type' => 'number', 249 'title' => __('Number of Rooms', 'tourfic' ), 250 'subtitle' => __( 'Number of available rooms for booking', 'tourfic' ), 251 ), 252 253 array( 254 'id' => '', 255 'class' => 'tf-csf-disable tf-csf-pro', 256 'type' => 'switcher', 257 'title' => __('Reduce Number of Rooms by Orders', 'tourfic' ), 258 'subtitle' => __( 'Reduce the number of available rooms for booking by WooCommerce orders details' .$badge_pro, 'tourfic' ), 259 'text_on' => __('Yes', 'tourfic' ), 260 'text_off' => __('No', 'tourfic' ), 261 'default' => false, 229 262 ), 230 263 … … 235 268 236 269 array( 237 'id' => 'gallery',238 'type' => 'gallery',239 'title' => __('Gallery', 'tourfic' ),240 'subtitle' => 241 ), 242 243 array( 244 'id' => 'bed',245 'type' => 'number',246 'title' => __('Number of Beds', 'tourfic' ),247 'subtitle' => 248 ), 249 250 array( 251 'id' => 'adult',252 'type' => 'number',253 'title' => __('Number of Adults', 'tourfic' ),254 'subtitle' => 255 ), 256 257 array( 258 'id' => 'child',259 'type' => 'number',260 'title' => __('Number of Children', 'tourfic' ),261 'subtitle' => 262 ), 263 264 array( 265 'id' => 'footage',266 'type' => 'text',267 'title' => __('Room Footage', 'tourfic' ),268 'subtitle' => 269 ), 270 271 array( 272 'id' => 'features',273 'type' => 'select',274 'title' => __('Select Features', 'tourfic' ),275 'placeholder' => __('Select', 'tourfic' ),270 'id' => 'gallery', 271 'type' => 'gallery', 272 'title' => __('Gallery', 'tourfic' ), 273 'subtitle' => __( 'Upload images to make a gallery image for room', 'tourfic' ), 274 ), 275 276 array( 277 'id' => 'bed', 278 'type' => 'number', 279 'title' => __('Number of Beds', 'tourfic' ), 280 'subtitle' => __( 'Number of beds present in the room', 'tourfic' ), 281 ), 282 283 array( 284 'id' => 'adult', 285 'type' => 'number', 286 'title' => __('Number of Adults', 'tourfic' ), 287 'subtitle' => __( 'Max number of persons allowed in the room', 'tourfic' ), 288 ), 289 290 array( 291 'id' => 'child', 292 'type' => 'number', 293 'title' => __('Number of Children', 'tourfic' ), 294 'subtitle' => __( 'Max number of persons allowed in the room', 'tourfic' ), 295 ), 296 297 array( 298 'id' => 'footage', 299 'type' => 'text', 300 'title' => __('Room Footage', 'tourfic' ), 301 'subtitle' => __( 'Room footage (sft)', 'tourfic' ), 302 ), 303 304 array( 305 'id' => 'features', 306 'type' => 'select', 307 'title' => __('Select Features', 'tourfic' ), 308 'placeholder' => __('Select', 'tourfic' ), 276 309 'empty_message' => __('No feature available', 'tourfic' ), 277 'chosen' => true,278 'multiple' => true,279 'options' => 'categories',280 'query_args' => array(310 'chosen' => true, 311 'multiple' => true, 312 'options' => 'categories', 313 'query_args' => array( 281 314 'taxonomy' => 'hotel_feature', 282 315 ), … … 295 328 296 329 array( 297 'id' 298 'type' 299 'title' 300 'options' 330 'id' => 'pricing-by', 331 'type' => 'select', 332 'title' => __('Pricing by', 'tourfic' ), 333 'options' => array( 301 334 '1' => __('Per room', 'tourfic' ), 302 335 '2' => __('Per person (Pro)', 'tourfic' ), … … 306 339 307 340 array( 308 'id' => 'price',309 'type' => 'text',310 'title' => __('Pricing', 'tourfic' ),311 'desc' =>__( 'The price of room per one night', 'tourfic' ),341 'id' => 'price', 342 'type' => 'text', 343 'title' => __('Pricing', 'tourfic' ), 344 'desc' => __( 'The price of room per one night', 'tourfic' ), 312 345 'dependency' => array( 'pricing-by', '==', '1' ), 313 346 ), 314 347 315 348 array( 316 'id' => '',317 'class' => 'tf-csf-disable tf-csf-pro',318 'type' => 'text',319 'title' => __('Adult Pricing', 'tourfic' ),349 'id' => '', 350 'class' => 'tf-csf-disable tf-csf-pro', 351 'type' => 'text', 352 'title' => __('Adult Pricing', 'tourfic' ), 320 353 'subtitle' => $badge_pro, 321 'desc' =>__( 'The price of room per one night', 'tourfic' ),354 'desc' => __( 'The price of room per one night', 'tourfic' ), 322 355 'dependency' => array( 'pricing-by', '==', '2' ), 323 356 ), 324 357 325 358 array( 326 'id' => '',327 'class' => 'tf-csf-disable tf-csf-pro',328 'type' => 'text',329 'title' => __('Children Pricing', 'tourfic' ),359 'id' => '', 360 'class' => 'tf-csf-disable tf-csf-pro', 361 'type' => 'text', 362 'title' => __('Children Pricing', 'tourfic' ), 330 363 'subtitle' => $badge_pro, 331 'desc' =>__( 'The price of room per one night', 'tourfic' ),364 'desc' => __( 'The price of room per one night', 'tourfic' ), 332 365 'dependency' => array( 'pricing-by', '==', '2' ), 333 366 ), … … 336 369 'id' => 'price_multi_day', 337 370 'type' => 'switcher', 338 'title' => __('Multiply Pricing By Day', 'tourfic' ),339 ' subtitle' => __( 'Dyring booking pricing will be multiplied by day number(Check-in to Check-out)', 'tourfic' ),371 'title' => __('Multiply Pricing By Night', 'tourfic' ), 372 'label' => __( 'During booking pricing will be multiplied by number of nights (Check-in to Check-out)', 'tourfic' ), 340 373 'text_on' => __('Yes', 'tourfic' ), 341 374 'text_off' => __('No', 'tourfic' ), 342 'default' => true,375 'default' => true, 343 376 ), 344 377 … … 349 382 350 383 array( 351 'id' => '', 352 'class' => 'tf-csf-disable tf-csf-pro', 353 'type' => 'datetime', 354 'title' => __( 'Date', 'tourfic' ), 355 'subtitle' => __( 'Select availablity date' .$badge_up_pro, 'tourfic' ), 356 'settings' => array( 357 'dateFormat' => 'Y/m/d' 384 'id' => '', 385 'class' => 'tf-csf-disable tf-csf-pro', 386 'type' => 'switcher', 387 'title' => __( 'Enable Availability by Date', 'tourfic' ), 388 'subtitle' => __( $badge_pro, 'tourfic' ), 389 'default' => true 358 390 ), 359 'from_to' => true, 360 'text_from' => __('From', 'tourfic' ), 361 'text_to' => __('To', 'tourfic' ), 362 ), 391 array( 392 'id' => '', 393 'class' => 'repeater-by-date', 394 'type' => 'repeater', 395 'title' => __( 'By Date', 'tourfic' ), 396 'subtitle' => __( $badge_pro, 'tourfic' ), 397 'fields' => array( 398 399 array( 400 'id' => '', 401 'class' => 'tf-csf-disable tf-csf-pro', 402 'type' => 'datetime', 403 'title' => __( 'Date Range', 'tourfic' ), 404 'subtitle' => __( 'Select availablity date range', 'tourfic' ), 405 'settings' => array( 406 'dateFormat' => 'Y/m/d' 407 ), 408 'from_to' => true, 409 'text_from' => __('From', 'tourfic' ), 410 'text_to' => __('To', 'tourfic' ), 411 ), 412 array( 413 'id' => '', 414 'class' => 'tf-csf-disable tf-csf-pro', 415 'type' => 'number', 416 'title' => __('Number of Rooms', 'tourfic' ), 417 'subtitle' => __( 'Number of available rooms for booking on this date range', 'tourfic' ), 418 ), 419 420 421 array( 422 'id' => '', 423 'class' => 'tf-csf-disable tf-csf-pro', 424 'type' => 'text', 425 'title' => __('Pricing', 'tourfic' ), 426 'desc' => __( 'The price of room per one night', 'tourfic' ), 427 ), 428 429 array( 430 'id' => '', 431 'class' => 'tf-csf-disable tf-csf-pro', 432 'type' => 'text', 433 'title' => __('Adult Pricing', 'tourfic' ), 434 'desc' => __( 'The price of room per one night', 'tourfic' ), 435 ), 436 437 array( 438 'id' => '', 439 'class' => 'tf-csf-disable tf-csf-pro', 440 'type' => 'text', 441 'title' => __('Children Pricing', 'tourfic' ), 442 'desc' => __( 'The price of room per one night', 'tourfic' ), 443 ), 444 445 ), 446 ), 363 447 364 448 ), … … 374 458 375 459 array( 376 'id' => 'faq',377 'type' => 'repeater',378 'title' => __('Frequently Asked Questions', 'tourfic' ),460 'id' => 'faq', 461 'type' => 'repeater', 462 'title' => __('Frequently Asked Questions', 'tourfic' ), 379 463 'button_title' => __( 'Add FAQ', 'tourfic' ), 380 'fields' => array(464 'fields' => array( 381 465 382 466 array( … … 426 510 array( 427 511 'id' => 'h-review', 428 'class' => 'tf-csf-disable tf-csf-pro',429 512 'type' => 'switcher', 430 513 'title' => __('Disable Review Section', 'tourfic' ), 431 'subtitle' => $badge_pro,432 514 'text_on' => __('Yes', 'tourfic' ), 433 515 'text_off' => __('No', 'tourfic' ), … … 437 519 array( 438 520 'id' => 'h-share', 439 'class' => 'tf-csf-disable tf-csf-pro',440 521 'type' => 'switcher', 441 522 'title' => __('Disable Share Option', 'tourfic' ), 442 'subtitle' => $badge_pro,443 523 'text_on' => __('Yes', 'tourfic' ), 444 524 'text_off' => __('No', 'tourfic' ), -
tourfic/trunk/assets/css/tourfic-styles.css
r2715826 r2742744 14 14 padding: 0; 15 15 display: flex; 16 flex-wrap: wrap; 16 17 } 17 18 .tourfic-wrap svg { … … 132 133 display: flex; 133 134 align-items: center; 134 } 135 136 .share-tour { 137 margin-right: 14px; 135 column-gap: 5px; 138 136 } 139 137 … … 1293 1291 } 1294 1292 1295 .share-tour {1296 position: relative;1297 }1298 1299 1293 .share-tour-content { 1300 1294 display: none; … … 1321 1315 display: flex; 1322 1316 align-items: center; 1317 column-gap: 5px; 1323 1318 } 1324 1319 .share-tour-content .tf-dropdown__item-content svg { … … 1338 1333 align-items: center; 1339 1334 font-weight: 400; 1335 font-size: 14px; 1340 1336 } 1341 1337 .share-tour-content .tf-dropdown__item:hover { … … 2736 2732 order: 2; 2737 2733 flex-grow: 1; 2738 -ms-flex: 1;2739 2734 flex-basis: 200px; 2740 2735 padding: 0 0 0 16px; … … 2779 2774 order: 2; 2780 2775 flex-grow: 1; 2781 -ms-flex: 1;2782 2776 } 2783 2777 … … 2968 2962 display: inline-flex; 2969 2963 margin-left: 10px; 2970 opacity: 0.4; 2964 color: #333; 2965 font-size: 20px; 2971 2966 } 2972 2967 .tf-list-grid a:hover, .tf-list-grid a.active { 2973 opacity: 1;2968 color: #000; 2974 2969 } 2975 2970 -
tourfic/trunk/assets/css/tourfic.css
r2715826 r2742744 63 63 .fancybox-container { 64 64 z-index: 999999; 65 } 66 .tf-single-share { 67 position: relative; 68 margin: 0 15px 0 0; 69 } 70 .tf-single-share a { 71 font-size: 20px; 72 color: #333; 65 73 } 66 74 … … 222 230 | Hotel CSS | 223 231 ================================*/ 232 .tf-share { 233 position: relative; 234 } 235 .tf-share a { 236 color: #333; 237 line-height: 1; 238 font-size: 22px; 239 display: block; 240 margin: 0 10px 0 0; 241 outline: none; 242 } 224 243 .tf_room-table .availability-table tbody tr:nth-child(odd) td{ 225 244 background: #fff; 226 245 } 227 228 246 /* the slides */ 229 247 .slick-slide { … … 260 278 .hotel-room-wrap { 261 279 width: 100%; 280 overflow-x: auto; 262 281 } 263 282 -
tourfic/trunk/assets/css/tourfic.min.css
r2715826 r2742744 1 .tf-d-b{display:block!important}.tf-d-g{display:grid!important}.tf-d-f{display:flex!important}.tf-d-i{display:inline!important}.tf-d-ib{display:inline-block!important}.tf-d-ig{display:inline-grid!important}.tf-d-if{display:inline-flex!important}.tf-d-n{display:none!important}.tf-p-a{position:absolute!important}.tf-p-f{position:fixed!important}.tf-p-r{position:relative!important}.tf-t-l{text-align:left!important}.tf-t-c{text-align:center!important}.tf-t-r{text-align:right!important}.tf-t-j{text-align:justify!important}.tf-nothing-found{font-size:24px;font-weight:400;color:#333;text-align:center;margin:20% 0 20% 0}.fancybox-container{z-index:999999}.tf- tooltip{position:relative}.tf-tooltip .tf-top{top:-20px;left:50%;transform:translate(-50%,-74%);padding:10px 10px;color:#fff;background-color:#333;font-weight:400;font-size:12px;border-radius:4px;position:absolute;z-index:99999999;box-sizing:border-box;border:1px solid #333;box-shadow:0 1px 8px transparent;visibility:hidden;opacity:0;transition:opacity .8s;text-align:center;line-height:1;white-space:nowrap}.tf-tooltip:hover .tf-top{visibility:visible;opacity:1}.tf-tooltip .tf-top i.tool-i{position:absolute;top:100%;left:50%;margin-left:-12px;width:24px;height:12px;overflow:hidden}.tf-tooltip .tf-top i.tool-i::after{content:'';position:absolute;width:12px;height:12px;left:50%;transform:translate(-50%,-50%) rotate(45deg);background-color:#333;border:1px solid #333;box-shadow:0 1px 8px transparent}.tf-single-rating{position:absolute;left:0;top:0;line-height:1;color:#333;font-size:16px;cursor:pointer;z-index:999;display:flex;align-items:center;background:rgba(19,55,116,.24);border:1px solid rgba(255,255,255,.08);box-sizing:border-box;padding:8px;color:#fff;border-radius:8px}.tf-single-rating i{font-size:14px;color:#ffcd3d}.tf-single-rating span{margin:0 3px 0 5px;font-weight:600;font-size:18px}.tf-single-tour-pricing{width:200px}.tf-single-tour-pricing .tf-price{font-weight:400;font-size:16px;line-height:1;color:#9696a0;display:flex;align-items:center;margin:0;padding:0;justify-content:center}.tf-single-tour-pricing .tf-price span.sale-price{font-weight:600;font-size:24px;line-height:1;color:#133774;margin:0 8px 0 0}.tf-single-tour-pricing .tf-price-tab{list-style:none;display:flex;line-height:1;font-size:14px;font-weight:600;color:#5a5b6a;flex-direction:row;justify-content:space-evenly;margin:10px 0 0 0;border:1px solid #d8e6ff;box-sizing:border-box;border-radius:8px 8px 8px 8px;cursor:pointer}.tf-single-tour-pricing .tf-price-tab li{padding:0;width:100%;text-align:center;height:36px;justify-content:center;align-content:center;display:flex;align-items:center;transition:.3s}.tf-single-tour-pricing .tf-price-tab li:hover{color:#133774;background:#f5f8ff}.tf-single-tour-pricing .tf-price-tab li:nth-child(2){border-left:1px solid #d8e6ff}.tf-single-tour-pricing .tf-price-tab li:nth-child(3){border-left:1px solid #d8e6ff}.tf-single-tour-pricing .tf-price-tab li.active{color:#133774;background:#d8e6ff}.tf-suggestion-item{background-position:center center}.tf_room-table .availability-table tbody tr:nth-child(odd) td{background:#fff}.slick-slide{margin-left:5px!important;margin-right:5px!important}.slick-list{margin-left:-5px!important;margin-right:-5px!important}.tf-hotel-side-booking .tf_form-inner{position:relative;display:grid;padding:0;background:#fff;grid-template-columns:38px auto;align-items:center;justify-items:center}.tf-hotel-side-booking .tf_form-inner i{color:#bfbfbf;font-size:16px}.hotel-room-wrap{width:100%}.tf_room-table th.description{border-top:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;border-right:1px solid #f2f2f2}.tf_room-table th.pax{border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table th.pricing{border-top:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table th.reserve{border-top:1px solid #f2f2f2;border-right:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table td.description{border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;border-right:1px solid #f2f2f2}.tf_room-table td.pax{border-bottom:1px solid #f2f2f2;min-width:80px}.tf_room-table td.pricing{border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2}.tf_room-table td.reserve{border-right:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2}.room-detail-icon{text-align:center;margin:15px 0 0 0}.room-detail-icon .room-icon-wrap{border:1px solid #eaeef3;border-radius:5px;padding:8px 10px 4px 10px}.room-detail-icon .room-icon-wrap i{font-size:18px;color:#5e6d77}.room-detail-icon .icon-text{font-size:14px;color:#5e6d77}.hotel-room-availability,.hotel-room-book{background:#003162;color:#fff;text-decoration:none;display:inline-block;text-align:center;font-size:12px;border:1px solid #003162;border-radius:2px;padding:6px 12px;white-space:nowrap}#hotel-room-selected{width:50%;height:30px;text-align:center;border:1px solid #ddd;border-radius:3px;color:#333;outline:0;padding:0}.tf-hotel-side-booking #check-in-out-date{font-size:13px;min-width:150px;padding:0}:root{--tf-star-filled-color:#FFC314;--tf-star-border:#E1E1E3;--tf-star:"\f005";--tf-star-size:22px}.tf-review-form-container{min-width:600px;padding:0!important;margin:0!important;background:#fff!important}.tf-review-form-container .logged-in-as{display:none}.tf-review-form-container .tf-rating-wrapper{display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;row-gap:15px;margin:0 0 80px 0}.tf-review-form-container .tf-rating-wrapper .tf-form-single-rating{display:grid;grid-template-columns:auto auto;justify-content:space-between;align-items:center;column-gap:20px}.tf-review-form-container .tf-form-single-rating .error{color:red}.tf-review-form-container .tf-rating-wrapper .tf-form-single-rating label{color:#333;font-style:normal;font-weight:500;font-size:16px;line-height:1;text-transform:capitalize}.tf-review-form-container .tf-form-single-rating .ratings-container{line-height:1;unicode-bidi:bidi-override;direction:rtl}.tf-review-form-container .tf-form-single-rating .ratings-container.star10{width:220px}.tf-review-form-container .tf-form-single-rating .ratings-container.star5{width:110px}.tf-review-form-container .tf-form-single-rating .ratings-container label{padding:0;margin:0;height:auto;line-height:1;color:transparent}.tf-review-form-container .tf-form-single-rating .ratings-container>input{display:none}.tf-review-form-container .ratings-container>input+label{text-indent:-9999px;font-family:"Font Awesome 5 Free";display:inline-block;overflow:hidden;width:var(--tf-star-size);white-space:nowrap;cursor:pointer;color:transparent}.tf-review-form-container .ratings-container>.star-cb-clear+label,.tf-review-form-container .ratings-container>input+label:before{text-indent:9999px}.tf-review-form-container .ratings-container>input+label:before{display:inline-block;content:var(--tf-star);color:var(--tf-star-border);font-size:18px}.tf-review-form-container .ratings-container>input+label:hover:before,.tf-review-form-container .ratings-container>input+label:hover~label:before,.tf-review-form-container .ratings-container>input:checked~label:before{content:var(--tf-star);color:var(--tf-star-filled-color);font-weight:900}.tf-review-form-container .ratings-container>.star-cb-clear+label{text-indent:-9999px;width:.5em;margin-left:-.5em}.tf-review-form-container .ratings-container>.star-cb-clear+label:before{width:.5em}.tf-review-form-container .ratings-container:hover>input+label:before{content:var(--tf-star);color:var(--tf-star-border)}.tf-review-form-container .ratings-container:hover>input+label:hover:before,.tf-review-form-container .ratings-container:hover>input+label:hover~label:before{content:var(--tf-star);color:var(--tf-star-filled-color);font-weight:900}.tf-review-form-container .review-desc textarea{background:#f7f7fa;border:1px solid #ededf0;border-radius:8px;padding:16px 8px 16px 16px;height:160px;outline:0;color:#333;box-shadow:none;width:100%}.tf-review-form-container .tf-visitor-info{display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;margin:40px 0 0 0}.tf-review-form-container .tf-visitor-info input{background:#f7f7fa;border:1px solid #ededf0;box-sizing:border-box;border-radius:8px;height:56px;padding:16px 8px 16px 16px;outline:0;color:#333;box-shadow:none;width:100%}.tf-review-form-container .tf-visitor-info .error{color:red}.tf-review-form-container .tf-review-submit{margin:40px 0 0 0}.tf-review-form-container .tf-review-submit input[type=submit]{background:#2979ff;border-radius:4px;height:56px;padding:16px 32px;width:100%;color:#fff;font-style:normal;font-weight:500;font-size:16px;line-height:1;border:none}.tf-review-container .no-comments{display:none}.tf-review-container .tf-total-review{display:grid;grid-template-columns:auto auto;justify-content:space-between;align-items:center;margin:0 0 25px 0}.tf-review-container .tf-total-review .tf-total-average{display:grid;grid-template-columns:auto auto;align-items:center}.tf-review-container .tf-total-review .tf-total-average div{width:60px;height:60px;background:#4f91ff;border-radius:8px;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:16px;color:#fff;font-weight:600;font-size:24px;line-height:32px}.tf-review-container .tf-total-review .tf-total-average span{color:#9696a0;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin:0 16px}.tf-review-container button{color:#2979ff;font-style:normal;font-weight:400;font-size:16px;line-height:24px;background:#ebf2ff;border:1px solid #2979ff;box-sizing:border-box;border-radius:4px;padding:8px 16px;outline:0}.tf-review-container button i{font-size:14px}.tf-review-container .tf-review-progress-bar{background:#f7f7fa;display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;row-gap:20px;padding:24px;border:1px solid #ededf0;box-sizing:border-box;border-radius:8px;margin:0 0 25px 0}.tf-review-container .tf-review-progress-bar .tf-single{display:grid;grid-template-columns:calc(50% - 15px) calc(50% - 15px) 30px;align-items:center}.tf-review-container .tf-review-progress-bar .tf-single .tf-text{text-align:left;color:#5a5b6a;font-style:normal;font-weight:400;font-size:14px;line-height:1;text-transform:capitalize}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-bar{width:100%;height:7px;background:#d8e6ff;border-radius:7px;position:relative;overflow:hidden}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-bar .percent-progress{position:absolute;width:0;background-color:#76a9ff;height:100%;transition:width 1s ease-in-out}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-b-rating{text-align:right;font-style:normal;font-weight:500;font-size:14px;line-height:1;color:#5a5b6a}.tf-review-container .no-review{text-align:center}.tf-single-review{display:grid;grid-template-columns:calc(50% - 10px) calc(50% - 10px);column-gap:20px;row-gap:40px}.tf-single-review .tf-single-details{display:grid;grid-template-columns:56px calc(100% - 72px);column-gap:16px}.tf-single-review .tf-review-avatar{width:56px;height:56px;border-radius:50%;overflow:hidden}.tf-single-review .tf-review-details .tf-name{font-style:normal;font-weight:500;font-size:18px;line-height:1;color:#3a3a44;margin:0 0 8px 0;text-transform:capitalize}.tf-single-review .tf-review-details .tf-date{font-style:normal;font-weight:400;font-size:12px;line-height:1;color:#5a5b6a;letter-spacing:.2px;margin:0 0 8px}.tf-single-review .tf-review-details .tf-rating-stars{display:grid;grid-template-columns:auto auto;column-gap:5px;align-items:center;justify-content:start;line-height:1}.tf-single-review .tf-review-details .tf-rating-stars i{color:#ffbf00;font-size:10px;height:14px}.tf-single-review .tf-review-details .tf-description{font-style:normal;font-weight:400;font-size:14px;line-height:22px;color:#5a5b6a;margin:8px 0 0 0}.tf-review-pending{text-align:center;font-size:16px;font-style:italic;font-weight:400;background:#fff4a3;border-radius:4px;padding:10px 10px;color:#333;margin:30px 0 10px 0}.wish-button{background:#f1fbf3;color:#333;font-weight:600;font-size:12px;line-height:1;padding:5px 7px;border-radius:2px;margin:0;transition:.3s}.tf-wishlists .remove-wishlist{cursor:pointer}.wish-button:hover{background:#333;color:#f1fbf3}.tf-wishlist-button{font-size:24px;cursor:pointer;margin:0 5px 0 0;line-height:1;color:#333}.single-tour-wish-bt{position:absolute;right:0;top:0;line-height:1;color:#333;font-size:24px;cursor:pointer;z-index:999}.tf-text-preloader{position:relative}.tf-text-preloader .tf-bar{background-color:#e7e7e7;height:14px;border-radius:7px;width:80%}.tf-text-preloader:after{position:absolute;transform:translateY(-50%);top:50%;left:0;content:"";display:block;width:100%;height:24px;background-image:linear-gradient(100deg,rgba(255,255,255,0),rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 80%);background-size:200px 24px;background-position:-100px 0;background-repeat:no-repeat;animation:tfTextLoader 1s infinite}@keyframes tfTextLoader{0%{background-position:100% 0}25%{background-position:80% 0}50%{background-position:60% 0}75%{background-position:40% 0}100%{background-position:20% 0}}.tf-text-center{text-align:center}.tf-text-red{color:#c00}.tf-archive-rating{width:40px;height:40px;line-height:1;background:#133774;border-radius:8px;display:flex;flex-direction:row;justify-content:center;align-items:center}.tf-archive-rating span{font-weight:600;font-size:14px;color:#fff}.tf_form-inner .autocomplete-items{position:absolute;border:1px solid #d4d4d4;border-bottom:none;border-top:none;z-index:99;top:100%;left:0;right:0}.tf_form-inner .autocomplete-items div{padding:10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;color:#444}.tf_form-inner .autocomplete-items div:hover{background-color:#e9e9e9}.tf_booking-widget .tf_form-row .tf_button{padding:15px 20px;width:100%}.single-tour-inner .tf_button{padding:15px 20px;border-radius:8px}.tf_booking-widget #check-in-out-date{font-size:13px;min-width:150px}.widget_tf_hotel_filter .tf-filter ul{display:block;margin:0}.widget_tf_hotel_filter .tf-filter ul li{background:#f2f2f2;margin:0 0 3px 0;padding:8px 10px 8px 10px;justify-content:space-between}.widget_tf_hotel_filter .tf-filter ul li label{display:grid;grid-template-columns:11% 13% 76%;align-items:center;line-height:1;color:#333;cursor:pointer}.widget_tf_hotel_filter .tf-filter ul li label input{outline:0;width:14px;height:14px;color:#333}.widget_tf_hotel_filter .tf-filter ul li span{display:block;text-align:center;background:#333;border-radius:50%;line-height:20px;width:20px;height:20px;color:#fff;font-size:12px}.tf-widget-slider{padding:40px 0 40px 0;margin:0}.tf-widget-slider .tf-heading{text-align:center;margin:0 0 30px 0}.tf-widget-slider .tf-heading h2{font-size:28px;font-weight:600;line-height:32px;padding:0;margin:0 0 10px;color:#333}.tf-widget-slider .tf-heading p{font-size:16px;color:#555;line-height:18px;padding:0;margin:0}.tf-widget-slider .tf-slider-wrapper .tf-single img{border-top-right-radius:10px;border-top-left-radius:10px}.tf-widget-slider .tf-slider-wrapper .tf-single .tf-single-meta{text-align:center;background:#f2f2f2;border-bottom-left-radius:10px;border-bottom-right-radius:10px;padding:10px 10px 12px 10px}.tf-widget-slider .tf-slider-wrapper .tf-single .tf-single-meta .tf-title{color:#333;font-size:16px;line-height:18px;font-weight:600;margin:0;padding:0}.single-tf_hotel.theme-twentytwentytwo .slick-slide{height:auto!important}.single-tf_hotel.theme-twentytwentytwo .slick-slide img{height:auto!important}.single-tf_tours.theme-twentytwentytwo .tf-tour-booking-wrap{height:auto!important}1 .tf-d-b{display:block!important}.tf-d-g{display:grid!important}.tf-d-f{display:flex!important}.tf-d-i{display:inline!important}.tf-d-ib{display:inline-block!important}.tf-d-ig{display:inline-grid!important}.tf-d-if{display:inline-flex!important}.tf-d-n{display:none!important}.tf-p-a{position:absolute!important}.tf-p-f{position:fixed!important}.tf-p-r{position:relative!important}.tf-t-l{text-align:left!important}.tf-t-c{text-align:center!important}.tf-t-r{text-align:right!important}.tf-t-j{text-align:justify!important}.tf-nothing-found{font-size:24px;font-weight:400;color:#333;text-align:center;margin:20% 0 20% 0}.fancybox-container{z-index:999999}.tf-single-share{position:relative;margin:0 15px 0 0}.tf-single-share a{font-size:20px;color:#333}.tf-tooltip{position:relative}.tf-tooltip .tf-top{top:-20px;left:50%;transform:translate(-50%,-74%);padding:10px 10px;color:#fff;background-color:#333;font-weight:400;font-size:12px;border-radius:4px;position:absolute;z-index:99999999;box-sizing:border-box;border:1px solid #333;box-shadow:0 1px 8px transparent;visibility:hidden;opacity:0;transition:opacity .8s;text-align:center;line-height:1;white-space:nowrap}.tf-tooltip:hover .tf-top{visibility:visible;opacity:1}.tf-tooltip .tf-top i.tool-i{position:absolute;top:100%;left:50%;margin-left:-12px;width:24px;height:12px;overflow:hidden}.tf-tooltip .tf-top i.tool-i::after{content:'';position:absolute;width:12px;height:12px;left:50%;transform:translate(-50%,-50%) rotate(45deg);background-color:#333;border:1px solid #333;box-shadow:0 1px 8px transparent}.tf-single-rating{position:absolute;left:0;top:0;line-height:1;color:#333;font-size:16px;cursor:pointer;z-index:999;display:flex;align-items:center;background:rgba(19,55,116,.24);border:1px solid rgba(255,255,255,.08);box-sizing:border-box;padding:8px;color:#fff;border-radius:8px}.tf-single-rating i{font-size:14px;color:#ffcd3d}.tf-single-rating span{margin:0 3px 0 5px;font-weight:600;font-size:18px}.tf-single-tour-pricing{width:200px}.tf-single-tour-pricing .tf-price{font-weight:400;font-size:16px;line-height:1;color:#9696a0;display:flex;align-items:center;margin:0;padding:0;justify-content:center}.tf-single-tour-pricing .tf-price span.sale-price{font-weight:600;font-size:24px;line-height:1;color:#133774;margin:0 8px 0 0}.tf-single-tour-pricing .tf-price-tab{list-style:none;display:flex;line-height:1;font-size:14px;font-weight:600;color:#5a5b6a;flex-direction:row;justify-content:space-evenly;margin:10px 0 0 0;border:1px solid #d8e6ff;box-sizing:border-box;border-radius:8px 8px 8px 8px;cursor:pointer}.tf-single-tour-pricing .tf-price-tab li{padding:0;width:100%;text-align:center;height:36px;justify-content:center;align-content:center;display:flex;align-items:center;transition:.3s}.tf-single-tour-pricing .tf-price-tab li:hover{color:#133774;background:#f5f8ff}.tf-single-tour-pricing .tf-price-tab li:nth-child(2){border-left:1px solid #d8e6ff}.tf-single-tour-pricing .tf-price-tab li:nth-child(3){border-left:1px solid #d8e6ff}.tf-single-tour-pricing .tf-price-tab li.active{color:#133774;background:#d8e6ff}.tf-suggestion-item{background-position:center center}.tf-share{position:relative}.tf-share a{color:#333;line-height:1;font-size:22px;display:block;margin:0 10px 0 0;outline:0}.tf_room-table .availability-table tbody tr:nth-child(odd) td{background:#fff}.slick-slide{margin-left:5px!important;margin-right:5px!important}.slick-list{margin-left:-5px!important;margin-right:-5px!important}.tf-hotel-side-booking .tf_form-inner{position:relative;display:grid;padding:0;background:#fff;grid-template-columns:38px auto;align-items:center;justify-items:center}.tf-hotel-side-booking .tf_form-inner i{color:#bfbfbf;font-size:16px}.hotel-room-wrap{width:100%;overflow-x:auto}.tf_room-table th.description{border-top:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;border-right:1px solid #f2f2f2}.tf_room-table th.pax{border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table th.pricing{border-top:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table th.reserve{border-top:1px solid #f2f2f2;border-right:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;text-align:center}.tf_room-table td.description{border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;border-right:1px solid #f2f2f2}.tf_room-table td.pax{border-bottom:1px solid #f2f2f2;min-width:80px}.tf_room-table td.pricing{border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2}.tf_room-table td.reserve{border-right:1px solid #f2f2f2;border-left:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2}.room-detail-icon{text-align:center;margin:15px 0 0 0}.room-detail-icon .room-icon-wrap{border:1px solid #eaeef3;border-radius:5px;padding:8px 10px 4px 10px}.room-detail-icon .room-icon-wrap i{font-size:18px;color:#5e6d77}.room-detail-icon .icon-text{font-size:14px;color:#5e6d77}.hotel-room-availability,.hotel-room-book{background:#003162;color:#fff;text-decoration:none;display:inline-block;text-align:center;font-size:12px;border:1px solid #003162;border-radius:2px;padding:6px 12px;white-space:nowrap}#hotel-room-selected{width:50%;height:30px;text-align:center;border:1px solid #ddd;border-radius:3px;color:#333;outline:0;padding:0}.tf-hotel-side-booking #check-in-out-date{font-size:13px;min-width:150px;padding:0}:root{--tf-star-filled-color:#FFC314;--tf-star-border:#E1E1E3;--tf-star:"\f005";--tf-star-size:22px}.tf-review-form-container{min-width:600px;padding:0!important;margin:0!important;background:#fff!important}.tf-review-form-container .logged-in-as{display:none}.tf-review-form-container .tf-rating-wrapper{display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;row-gap:15px;margin:0 0 80px 0}.tf-review-form-container .tf-rating-wrapper .tf-form-single-rating{display:grid;grid-template-columns:auto auto;justify-content:space-between;align-items:center;column-gap:20px}.tf-review-form-container .tf-form-single-rating .error{color:red}.tf-review-form-container .tf-rating-wrapper .tf-form-single-rating label{color:#333;font-style:normal;font-weight:500;font-size:16px;line-height:1;text-transform:capitalize}.tf-review-form-container .tf-form-single-rating .ratings-container{line-height:1;unicode-bidi:bidi-override;direction:rtl}.tf-review-form-container .tf-form-single-rating .ratings-container.star10{width:220px}.tf-review-form-container .tf-form-single-rating .ratings-container.star5{width:110px}.tf-review-form-container .tf-form-single-rating .ratings-container label{padding:0;margin:0;height:auto;line-height:1;color:transparent}.tf-review-form-container .tf-form-single-rating .ratings-container>input{display:none}.tf-review-form-container .ratings-container>input+label{text-indent:-9999px;font-family:"Font Awesome 5 Free";display:inline-block;overflow:hidden;width:var(--tf-star-size);white-space:nowrap;cursor:pointer;color:transparent}.tf-review-form-container .ratings-container>.star-cb-clear+label,.tf-review-form-container .ratings-container>input+label:before{text-indent:9999px}.tf-review-form-container .ratings-container>input+label:before{display:inline-block;content:var(--tf-star);color:var(--tf-star-border);font-size:18px}.tf-review-form-container .ratings-container>input+label:hover:before,.tf-review-form-container .ratings-container>input+label:hover~label:before,.tf-review-form-container .ratings-container>input:checked~label:before{content:var(--tf-star);color:var(--tf-star-filled-color);font-weight:900}.tf-review-form-container .ratings-container>.star-cb-clear+label{text-indent:-9999px;width:.5em;margin-left:-.5em}.tf-review-form-container .ratings-container>.star-cb-clear+label:before{width:.5em}.tf-review-form-container .ratings-container:hover>input+label:before{content:var(--tf-star);color:var(--tf-star-border)}.tf-review-form-container .ratings-container:hover>input+label:hover:before,.tf-review-form-container .ratings-container:hover>input+label:hover~label:before{content:var(--tf-star);color:var(--tf-star-filled-color);font-weight:900}.tf-review-form-container .review-desc textarea{background:#f7f7fa;border:1px solid #ededf0;border-radius:8px;padding:16px 8px 16px 16px;height:160px;outline:0;color:#333;box-shadow:none;width:100%}.tf-review-form-container .tf-visitor-info{display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;margin:40px 0 0 0}.tf-review-form-container .tf-visitor-info input{background:#f7f7fa;border:1px solid #ededf0;box-sizing:border-box;border-radius:8px;height:56px;padding:16px 8px 16px 16px;outline:0;color:#333;box-shadow:none;width:100%}.tf-review-form-container .tf-visitor-info .error{color:red}.tf-review-form-container .tf-review-submit{margin:40px 0 0 0}.tf-review-form-container .tf-review-submit input[type=submit]{background:#2979ff;border-radius:4px;height:56px;padding:16px 32px;width:100%;color:#fff;font-style:normal;font-weight:500;font-size:16px;line-height:1;border:none}.tf-review-container .no-comments{display:none}.tf-review-container .tf-total-review{display:grid;grid-template-columns:auto auto;justify-content:space-between;align-items:center;margin:0 0 25px 0}.tf-review-container .tf-total-review .tf-total-average{display:grid;grid-template-columns:auto auto;align-items:center}.tf-review-container .tf-total-review .tf-total-average div{width:60px;height:60px;background:#4f91ff;border-radius:8px;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:16px;color:#fff;font-weight:600;font-size:24px;line-height:32px}.tf-review-container .tf-total-review .tf-total-average span{color:#9696a0;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin:0 16px}.tf-review-container button{color:#2979ff;font-style:normal;font-weight:400;font-size:16px;line-height:24px;background:#ebf2ff;border:1px solid #2979ff;box-sizing:border-box;border-radius:4px;padding:8px 16px;outline:0}.tf-review-container button i{font-size:14px}.tf-review-container .tf-review-progress-bar{background:#f7f7fa;display:grid;grid-template-columns:calc(50% - 20px) calc(50% - 20px);column-gap:40px;row-gap:20px;padding:24px;border:1px solid #ededf0;box-sizing:border-box;border-radius:8px;margin:0 0 25px 0}.tf-review-container .tf-review-progress-bar .tf-single{display:grid;grid-template-columns:calc(50% - 15px) calc(50% - 15px) 30px;align-items:center}.tf-review-container .tf-review-progress-bar .tf-single .tf-text{text-align:left;color:#5a5b6a;font-style:normal;font-weight:400;font-size:14px;line-height:1;text-transform:capitalize}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-bar{width:100%;height:7px;background:#d8e6ff;border-radius:7px;position:relative;overflow:hidden}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-bar .percent-progress{position:absolute;width:0;background-color:#76a9ff;height:100%;transition:width 1s ease-in-out}.tf-review-container .tf-review-progress-bar .tf-single .tf-p-b-rating{text-align:right;font-style:normal;font-weight:500;font-size:14px;line-height:1;color:#5a5b6a}.tf-review-container .no-review{text-align:center}.tf-single-review{display:grid;grid-template-columns:calc(50% - 10px) calc(50% - 10px);column-gap:20px;row-gap:40px}.tf-single-review .tf-single-details{display:grid;grid-template-columns:56px calc(100% - 72px);column-gap:16px}.tf-single-review .tf-review-avatar{width:56px;height:56px;border-radius:50%;overflow:hidden}.tf-single-review .tf-review-details .tf-name{font-style:normal;font-weight:500;font-size:18px;line-height:1;color:#3a3a44;margin:0 0 8px 0;text-transform:capitalize}.tf-single-review .tf-review-details .tf-date{font-style:normal;font-weight:400;font-size:12px;line-height:1;color:#5a5b6a;letter-spacing:.2px;margin:0 0 8px}.tf-single-review .tf-review-details .tf-rating-stars{display:grid;grid-template-columns:auto auto;column-gap:5px;align-items:center;justify-content:start;line-height:1}.tf-single-review .tf-review-details .tf-rating-stars i{color:#ffbf00;font-size:10px;height:14px}.tf-single-review .tf-review-details .tf-description{font-style:normal;font-weight:400;font-size:14px;line-height:22px;color:#5a5b6a;margin:8px 0 0 0}.tf-review-pending{text-align:center;font-size:16px;font-style:italic;font-weight:400;background:#fff4a3;border-radius:4px;padding:10px 10px;color:#333;margin:30px 0 10px 0}.wish-button{background:#f1fbf3;color:#333;font-weight:600;font-size:12px;line-height:1;padding:5px 7px;border-radius:2px;margin:0;transition:.3s}.tf-wishlists .remove-wishlist{cursor:pointer}.wish-button:hover{background:#333;color:#f1fbf3}.tf-wishlist-button{font-size:24px;cursor:pointer;margin:0 5px 0 0;line-height:1;color:#333}.single-tour-wish-bt{position:absolute;right:0;top:0;line-height:1;color:#333;font-size:24px;cursor:pointer;z-index:999}.tf-text-preloader{position:relative}.tf-text-preloader .tf-bar{background-color:#e7e7e7;height:14px;border-radius:7px;width:80%}.tf-text-preloader:after{position:absolute;transform:translateY(-50%);top:50%;left:0;content:"";display:block;width:100%;height:24px;background-image:linear-gradient(100deg,rgba(255,255,255,0),rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 80%);background-size:200px 24px;background-position:-100px 0;background-repeat:no-repeat;animation:tfTextLoader 1s infinite}@keyframes tfTextLoader{0%{background-position:100% 0}25%{background-position:80% 0}50%{background-position:60% 0}75%{background-position:40% 0}100%{background-position:20% 0}}.tf-text-center{text-align:center}.tf-text-red{color:#c00}.tf-archive-rating{width:40px;height:40px;line-height:1;background:#133774;border-radius:8px;display:flex;flex-direction:row;justify-content:center;align-items:center}.tf-archive-rating span{font-weight:600;font-size:14px;color:#fff}.tf_form-inner .autocomplete-items{position:absolute;border:1px solid #d4d4d4;border-bottom:none;border-top:none;z-index:99;top:100%;left:0;right:0}.tf_form-inner .autocomplete-items div{padding:10px;cursor:pointer;background-color:#fff;border-bottom:1px solid #d4d4d4;color:#444}.tf_form-inner .autocomplete-items div:hover{background-color:#e9e9e9}.tf_booking-widget .tf_form-row .tf_button{padding:15px 20px;width:100%}.single-tour-inner .tf_button{padding:15px 20px;border-radius:8px}.tf_booking-widget #check-in-out-date{font-size:13px;min-width:150px}.widget_tf_hotel_filter .tf-filter ul{display:block;margin:0}.widget_tf_hotel_filter .tf-filter ul li{background:#f2f2f2;margin:0 0 3px 0;padding:8px 10px 8px 10px;justify-content:space-between}.widget_tf_hotel_filter .tf-filter ul li label{display:grid;grid-template-columns:11% 13% 76%;align-items:center;line-height:1;color:#333;cursor:pointer}.widget_tf_hotel_filter .tf-filter ul li label input{outline:0;width:14px;height:14px;color:#333}.widget_tf_hotel_filter .tf-filter ul li span{display:block;text-align:center;background:#333;border-radius:50%;line-height:20px;width:20px;height:20px;color:#fff;font-size:12px}.tf-widget-slider{padding:40px 0 40px 0;margin:0}.tf-widget-slider .tf-heading{text-align:center;margin:0 0 30px 0}.tf-widget-slider .tf-heading h2{font-size:28px;font-weight:600;line-height:32px;padding:0;margin:0 0 10px;color:#333}.tf-widget-slider .tf-heading p{font-size:16px;color:#555;line-height:18px;padding:0;margin:0}.tf-widget-slider .tf-slider-wrapper .tf-single img{border-top-right-radius:10px;border-top-left-radius:10px}.tf-widget-slider .tf-slider-wrapper .tf-single .tf-single-meta{text-align:center;background:#f2f2f2;border-bottom-left-radius:10px;border-bottom-right-radius:10px;padding:10px 10px 12px 10px}.tf-widget-slider .tf-slider-wrapper .tf-single .tf-single-meta .tf-title{color:#333;font-size:16px;line-height:18px;font-weight:600;margin:0;padding:0}.single-tf_hotel.theme-twentytwentytwo .slick-slide{height:auto!important}.single-tf_hotel.theme-twentytwentytwo .slick-slide img{height:auto!important}.single-tf_tours.theme-twentytwentytwo .tf-tour-booking-wrap{height:auto!important} -
tourfic/trunk/assets/js/tourfic.js
r2715826 r2742744 26 26 27 27 if($.trim($('input[name=check-in-out-date]').val()) == ''){ 28 $('.tf_booking-dates .tf_label-row').append('<span clss="required"><b>'+tf_params.field_required+'</b></span>'); 28 29 if( $('#tf-required').length === 0 ) { 30 $('.tf_booking-dates .tf_label-row').append('<span id="tf-required" clss="required"><b>'+tf_params.field_required+'</b></span>'); 31 } 29 32 return; 30 33 } … … 103 106 var post_id = $('input[name=post_id]').val(); 104 107 var room_id = $(this).closest('.room-submit-wrap').find('input[name=room_id]').val(); 108 var unique_id = $(this).closest('.room-submit-wrap').find('input[name=unique_id]').val(); 105 109 var location = $('input[name=place]').val(); 106 110 var adult = $('input[name=adult]').val(); … … 116 120 post_id: post_id, 117 121 room_id: room_id, 122 unique_id: unique_id, 118 123 location: location, 119 124 adult: adult, … … 1218 1223 // End Feed Click Trigger 1219 1224 1220 //Ratings copy/move under gallery1221 // var avg_rating = $('.tf-overall-ratings .overall-rate').text();1222 // if(avg_rating){1223 // $('.reviews span').html(avg_rating);1224 // }else{1225 // $('.reviews span').html("0/5");1226 // }1227 1228 1225 $(".tf-travel-text h4").click(function(){ 1229 1226 $(this).siblings('.tf-travel-contetn').slideToggle(); -
tourfic/trunk/assets/js/tourfic.min.js
r2715826 r2742744 1 function tfOpenForm(t,e){var n,a,o;for(a=document.getElementsByClassName("tf-tabcontent"),n=0;n<a.length;n++)a[n].style.display="none";for(o=document.getElementsByClassName("tf-tablinks"),n=0;n<o.length;n++)o[n].className=o[n].className.replace(" active","");document.getElementById(e).style.display="block",document.getElementById(e).style.transition="all 0.2s",t.currentTarget.className+=" active"}function tf_load_rating(){jQuery("#commentform").show()}!function(t,e){t(document).ready(function(){const n=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});t(document).on("click","#tf-single-hotel-avail .tf-submit",function(e){if(e.preventDefault(),""!=t.trim(t("input[name=check-in-out-date]").val())){var n={action:"tf_room_availability",tf_room_avail_nonce:t("input[name=tf_room_avail_nonce]").val(),post_id:t("input[name=post_id]").val(),adult:t("select[name=adults] option").filter(":selected").val(),child:t("select[name=children] option").filter(":selected").val(),check_in_out:t("input[name=check-in-out-date]").val()};jQuery.ajax({url:tf_params.ajax_url,type:"post",data:n,success:function(e){t("html, body").animate({scrollTop:t("#rooms").offset().top},500),t("#rooms").html(e)},error:function(t,e){var n="";if(0===t.status)n="Not connect.\n Verify Network.";else if(404==t.status)n="Requested page not found. [404]";else if(500==t.status)n="Internal Server Error [500].";else if("parsererror"===e)n="Requested JSON parse failed.";else if("timeout"===e)n="Time out error.";else if("abort"===e)n="Ajax request aborted.";else n="Uncaught Error.\n"+t.responseText;alert(n)}})}else t(".tf_booking-dates .tf_label-row").append('<span clss="required"><b>'+tf_params.field_required+"</b></span>")}),t(document).on("click",".hotel-room-availability",function(e){e.preventDefault(),t("html, body").animate({scrollTop:t("#tf-single-hotel-avail").offset().top},500)}),t(document).on("click",".hotel-room-book",function(e){e.preventDefault();var n=t(this),a={action:"tf_hotel_booking",tf_room_booking_nonce:t("input[name=tf_room_booking_nonce]").val(),post_id:t("input[name=post_id]").val(),room_id:t(this).closest(".room-submit-wrap").find("input[name=room_id]").val(),location:t("input[name=place]").val(),adult:t("input[name=adult]").val(),child:t("input[name=child]").val(),check_in_date:t("input[name=check_in_date]").val(),check_out_date:t("input[name=check_out_date]").val(),room:t(this).closest(".reserve").find("select[name=hotel_room_selected] option").filter(":selected").val()};t.ajax({type:"post",url:tf_params.ajax_url,data:a,beforeSend:function(e){n.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),t(".tf_notice_wrapper").html("").hide()},complete:function(t){n.unblock()},success:function(e){n.unblock();var a=JSON.parse(e);if("error"==a.status){var o="";return a.errors&&a.errors.forEach(function(t){o+='<div class="woocommerce-error">'+t+"</div>"}),t(".tf_notice_wrapper").html(o).show(),t("html, body").animate({scrollTop:0},300),!1}a.redirect_to?window.location.replace(a.redirect_to):jQuery(document.body).trigger("added_to_cart")},error:function(t){console.log(t)}})}),t('[data-fancybox="hotel-gallery"]').fancybox({loop:!0,buttons:["zoom","slideShow","fullScreen","close"],hash:!1});var a,o=t(".swiper-button-prev"),s=t(".swiper-button-next");t(".single-slider-wrapper .tf_slider-for").slick({slide:".slick-slide-item",slidesToShow:1,slidesToScroll:1,arrows:!1,fade:!1,dots:!1,centerMode:!1,variableWidth:!1}),o.on("click",function(){t(this).closest(".single-slider-wrapper").find(".tf_slider-for").slick("slickPrev")}),s.on("click",function(){t(this).closest(".single-slider-wrapper").find(".tf_slider-for").slick("slickNext")}),t(".reserve-button a").click(function(){t("html, body").animate({scrollTop:t("#rooms").offset().top-32},1e3)}),t(document).on("submit","form.tf_tours_booking",function(e){e.preventDefault();var n=t(this),a=new FormData(this);a.append("action","tf_tours_booking");var o=0;jQuery(".tour-extra-single input:checkbox:checked").each(function(){o+=isNaN(parseInt(jQuery(this).val()))?0:parseInt(jQuery(this).val())}),a.append("tour_extra_total",o);var s=t(".tour-extra-single input:checkbox:checked").map(function(){return t(this).data("title")}).get();a.append("tour_extra_title",s),t.ajax({type:"post",url:tf_params.ajax_url,data:a,processData:!1,contentType:!1,beforeSend:function(e){n.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),t(".tf_notice_wrapper").html("").hide()},complete:function(t){n.unblock()},success:function(e){n.unblock();var a=JSON.parse(e);if("error"==a.status){var o="";return a.errors&&a.errors.forEach(function(t){o+='<div class="woocommerce-error">'+t+"</div>"}),t(".tf_notice_wrapper").html(o).show(),t("html, body").animate({scrollTop:0},300),!1}a.redirect_to?window.location.replace(a.redirect_to):jQuery(document.body).trigger("added_to_cart"),console.log(a)},error:function(t){console.log(t)}})}),t('[data-fancybox="tour-gallery"]').fancybox({loop:!0,buttons:["zoom","slideShow","fullScreen","close"],hash:!1}),t(".tf-single-tour-pricing .tf-price-tab li").click(function(){var e=t(this).attr("id");t(this).addClass("active").siblings().removeClass("active"),t(".tf-price").addClass("tf-d-n"),t("."+e+"-price").removeClass("tf-d-n")});const i=()=>{var e=t("#tf-place").val(),o=t("#adults").val(),s=t("#room").val(),i=t("#children").val(),r=t("#check-in-out-date").val(),l=r.split(" to "),c=l[0],d=l[1],u=t(".tf-post-type").val(),f=[];t("[name*=tf_filters]").each(function(){t(this).is(":checked")&&f.push(t(this).val())});f=f.join();var p=[];t("[name*=tf_features]").each(function(){t(this).is(":checked")&&p.push(t(this).val())});p=p.join();var m=new FormData;m.append("action","tf_trigger_filter"),m.append("type",u),m.append("dest",e),m.append("adults",o),m.append("room",s),m.append("children",i),m.append("checkin",c),m.append("checkout",d),m.append("filters",f),m.append("features",p),m.append("checked",r),a&&4!=a.readyState&&a.abort(),a=t.ajax({type:"post",url:tf_params.ajax_url,data:m,processData:!1,contentType:!1,beforeSend:function(e){t(".archive_ajax_result").block({message:null,overlayCSS:{background:"#fff",opacity:.5}})},complete:function(e){t(".archive_ajax_result").unblock()},success:function(e){t(".archive_ajax_result").unblock(),t(".archive_ajax_result").html(e),n.success(tf_params.ajax_result_success)},error:function(t){console.log(t)}})};t(document).on("submit","#tf-widget-booking-search",function(t){t.preventDefault(),i()}),t(document).on("change","[name*=tf_filters],[name*=tf_features]",function(){i()}),t.fn.inViewport=function(n){return this.each(function(a,o){function s(){var e=t(this).height(),a=o.getBoundingClientRect(),s=a.top,i=a.bottom;return n.call(o,Math.max(0,s>0?e-s:i<e?i:e))}s(),t(e).on("resize scroll",s)})},t(window).load(function(){jQuery("[data-width]").each(function(){var t=jQuery(this),e=t.attr("data-width");t.inViewport(function(n){n>0?t.css("width",+e+"%"):t.css("width","0%")})})}),t('.share-toggle[data-toggle="true"]').click(function(e){e.preventDefault();var n=t(this).attr("href");t(n).slideToggle("fast")}),t("button#share_link_button").click(function(){t(this).addClass("copied"),setTimeout(function(){t("button#share_link_button").removeClass("copied")},3e3),t(this).parent().find("#share_link_input").select(),document.execCommand("copy")}),t(".faq-head").click(function(e){t(this).parent().toggleClass("active").find(".faq-content").slideToggle("fast")}),t(".itinerary-head").on("click",function(e){t(this).parent().toggleClass("active").find(".itinerary-content").slideToggle("fast")}),t(".tf-suggestion-items-wrapper").slick({dots:!0,arrows:!1,infinite:!0,speed:300,autoplaySpeed:2e3,slidesToShow:3,slidesToScroll:1,responsive:[{breakpoint:1024,settings:{slidesToShow:3,slidesToScroll:1,infinite:!0,dots:!0}},{breakpoint:600,settings:{slidesToShow:2,slidesToScroll:1}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1}}]}),t(".tf-review-items-wrapper").slick({dots:!0,arrows:!1,infinite:!0,speed:300,autoplay:!0,autoplaySpeed:2e3,slidesToShow:4,slidesToScroll:1,responsive:[{breakpoint:1024,settings:{slidesToShow:4,slidesToScroll:1,infinite:!0,dots:!0}},{breakpoint:600,settings:{slidesToShow:3,slidesToScroll:1}},{breakpoint:480,settings:{slidesToShow:2,slidesToScroll:1}}]});const r=()=>{let t=localStorage.getItem("wishlist_item");return null===t?[]:JSON.parse(t)},l=()=>{let e=t(".tf-wishlist-holder");t.each(e,function(e,n){let a=t(n).data("type");a=a?a.split(","):void 0;let o=r();void 0!==a&&(o=o.filter(t=>a.includes(t.type)));let s=o.map(t=>t.post),i={nonce:t(n).data("nonce"),action:"tf_generate_table",ids:s};t.post(tf_params.ajax_url,i,function(e){e.success&&t(n).html(e.data)})})},c=t=>{t.addClass("remove-wishlist"),t.addClass("fas"),t.addClass("tf-text-red"),t.removeClass("far"),t.removeClass("add-wishlist")},d=t=>{t.addClass("add-wishlist"),t.addClass("far"),t.removeClass("fas"),t.removeClass("tf-text-red"),t.removeClass("remove-wishlist")};function u(t,e){var n;function a(t){if(!t)return!1;!function(t){for(var e=0;e<t.length;e++)t[e].classList.remove("autocomplete-active")}(t),n>=t.length&&(n=0),n<0&&(n=t.length-1),t[n].classList.add("autocomplete-active")}function o(e){for(var n=document.getElementsByClassName("autocomplete-items"),a=0;a<n.length;a++)e!=n[a]&&e!=t&&n[a].parentNode.removeChild(n[a])}t.addEventListener("input",function(a){var s,i,r=this.value;if(o(),!r)return!1;n=-1,(s=document.createElement("DIV")).setAttribute("id",this.id+"autocomplete-list"),s.setAttribute("class","autocomplete-items"),this.parentNode.appendChild(s);var l=[];for(const[n,a]of Object.entries(e))a.substr(0,r.length).toUpperCase()==r.toUpperCase()?(l.push("found"),(i=document.createElement("DIV")).innerHTML="<strong>"+a.substr(0,r.length)+"</strong>",i.innerHTML+=a.substr(r.length),i.innerHTML+=`<input type='hidden' value="${a}" data-slug='${n}'> `,i.addEventListener("click",function(e){let n=this.getElementsByTagName("input")[0];t.value=n.value,t.closest("input").nextElementSibling.value=n.dataset.slug,o()}),s.appendChild(i)):l.push("notfound");-1==l.indexOf("found")&&((i=document.createElement("DIV")).innerHTML+="Not Found",i.innerHTML+="<input type='hidden' value=''>",i.addEventListener("click",function(e){t.value=this.getElementsByTagName("input")[0].value,o()}),s.appendChild(i))}),t.addEventListener("keydown",function(t){var e=document.getElementById(this.id+"autocomplete-list");e&&(e=e.getElementsByTagName("div")),40==t.keyCode?(n++,a(e)):38==t.keyCode?(n--,a(e)):13==t.keyCode&&(t.preventDefault(),n>-1&&e&&e[n].click())}),document.addEventListener("click",function(t){o(t.target)})}t(document).on("click",".add-wishlist",function(){let e=t(".add-wishlist"),a={type:e.data("type"),post:e.data("id")},o=e.data("page-title"),s=e.data("page-url"),i=void 0!==s?'<a class="wish-button" href="'+s+'">'+o+"</a>":"";return t("body").hasClass("logged-in")?(a.action="tf_add_to_wishlists",a.nonce=e.data("nonce"),t.ajax({type:"post",url:tf_params.ajax_url,data:a,beforeSend:function(t){n.success(tf_params.wishlist_add)},success:function(t){t.success&&(c(e),n.success({message:t.data+i,duration:4e3}))}})):!0===(t=>{let e=r();return 0===e.filter(e=>e.post==t.post).length&&(e.push(t),localStorage.setItem("wishlist_item",JSON.stringify(e)),!0)})(a)?(n.success(tf_params.wishlist_add),c(e),n.success({message:tf_params.wishlist_added+i,duration:4e3})):n.error(tf_params.wishlist_add_error),!1}),t("body").find(".tf-wishlist-holder").length&&l(),t(document).on("click",".remove-wishlist",function(){let e=t(".remove-wishlist"),a=e.data("id");if(t("body").hasClass("logged-in")){let o=e.closest("table"),s={id:a,action:"tf_remove_wishlist",type:o.data("type"),nonce:e.data("nonce")};t.get(tf_params.ajax_url,s,function(t){t.success&&("1"!=tf_params.single&&o.closest(".tf-wishlists").html(t.data),d(e),n.success(tf_params.wishlist_removed))})}else 1==(t=>{let e=r(),n=e.findIndex(e=>e.post==t);return console.log(n,t,e),n>=0&&(e.splice(n,1),console.log(e),localStorage.setItem("wishlist_item",JSON.stringify(e)),"1"!=tf_params.single&&l(),!0)})(a)?(d(e),n.success(tf_params.wishlist_removed)):n.error(tf_params.wishlist_remove_error)}),(()=>{if(!t(document).hasClass("logged-in")&&t(document).find(".add-wishlist")){let e=t(".add-wishlist"),n=e.data("id");r().findIndex(t=>t.post==n)>=0?c(e):d(e)}})();var f=document.getElementById("tf-location"),p=tf_params.locations;f&&u(f,p);var m=document.getElementById("tf-destination"),h=tf_params.tour_destinations;m&&u(m,h),t(window).scroll(function(){var e=t(".tf-tour-booking-wrap");t(window).scrollTop()>=800?e.addClass("tf-tours-fixed"):e.removeClass("tf-tours-fixed")}),t(document).on("click",".tf_selectperson-wrap .tf_input-inner,.tf_person-selection-wrap .tf_person-selection-inner",function(){t(".tf_acrselection-wrap").slideToggle("fast")}),jQuery(document).on("click",function(t){jQuery(t.target).closest(".tf_selectperson-wrap").length||jQuery(".tf_acrselection-wrap").slideUp("fast")}),t(".acr-inc").on("click",function(e){var n=t(this).parent().find("input");n.val(parseInt(n.val())+1).change()}),t(".acr-dec").on("click",function(e){var n=t(this).parent().find("input"),a=n.attr("min");n.val()>a&&n.val(n.val()-1).change()}),t(document).on("change","#adults",function(){var e=t(this).val();t(".adults-text").text(e+" "+tf_params.adult)}),t(document).on("change","#children",function(){var e=t(this).val();t(".child-text").text(e+" "+tf_params.children)}),t(document).on("change","#infant",function(){var e=t(this).val();t(".infant-text").text(e+" "+tf_params.infant)}),t(document).on("change","#room",function(){var e=t(this).val();t(".room-text").text(e+" "+tf_params.room)}),t(document).on("click","#reply-title",function(){var e=t(this);t("#commentform").slideToggle("fast","swing",function(){e.parent().toggleClass("active")})}),t(document).on("click","#tf-ask-question-trigger",function(e){e.preventDefault(),t("#tf-ask-question").fadeIn().find(".response").html("")}),t(document).on("click","span.close-aq",function(){t("#tf-ask-question").fadeOut()}),t(document).on("submit","form#ask-question",function(e){e.preventDefault();var n=t(this),a=new FormData(this);a.append("action","tf_ask_question"),t.ajax({type:"post",url:tf_params.ajax_url,data:a,processData:!1,contentType:!1,beforeSend:function(t){n.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),n.find(".response").html(tf_params.sending_ques)},complete:function(t){n.unblock()},success:function(t){n.unblock();var e=JSON.parse(t);"sent"==e.status?(n.find(".response").html(e.msg),n.find('[type="reset"]').trigger("click")):n.find(".response").html(e.msg)},error:function(t){console.log(t)}})}),t(document).on("click",".change-view",function(e){e.preventDefault(),t(".change-view").removeClass("active"),t(this).addClass("active"),"grid-view"==t(this).data("id")?t(".archive_ajax_result").addClass("tours-grid"):t(".archive_ajax_result").removeClass("tours-grid")});var g,v=!1;t(document).on("click",".tf_posts_navigation a.next.page-numbers",function(e){e.preventDefault();var n,a=e.target.href?e.target.href:t(this).context.href;n=a,g&&4!=g.readyState&&g.abort(),g=t.ajax({url:n,contentType:!1,processData:!1,asynch:!0,beforeSend:function(){t(document).find(".tf_posts_navigation").addClass("loading"),v=!0},success:function(e){t(".archive_ajax_result").append(t(".archive_ajax_result",e).html()),t(".tf_posts_navigation").html(t(".tf_posts_navigation",e).html()),v=!1,t(document).find(".tf_posts_navigation").removeClass("loading")}}),window.history.pushState({url:""+a},"",a)}),t(window).on("scroll",function(e){t(".tf_posts_navigation a.next.page-numbers").each(function(e,n){var a=t(this),o=t(window).height(),s=n.getBoundingClientRect(),i=s.top,r=(s.bottom,parseInt(i-o/2));!1===v&&o>=r&&a.trigger("click")})}),t(".tf-travel-text h4").click(function(){t(this).siblings(".tf-travel-contetn").slideToggle(),t(this).parents(".tf-travel-itinerary-item").siblings().find(".tf-travel-contetn").slideUp()}),t(".tf-faq-title").click(function(){t(this).siblings(".tf-faq-desc").slideToggle(),t(this).parents(".tf-faq-item").siblings().find(".tf-faq-desc").slideUp()}),t(".tf-header-menu-triger").click(function(){t(".tf-header-menu-wrap").slideToggle()})})}(jQuery,window),jQuery("#tf-hotel-booking-form").css("display","block"); 1 (function(a,b){a(document).ready(function(){function c(a,c){function d(a){return!!a&&void(e(a),g>=a.length&&(g=0),0>g&&(g=a.length-1),a[g].classList.add("autocomplete-active"))}function e(a){for(var b=0;b<a.length;b++)a[b].classList.remove("autocomplete-active")}function f(b){for(var c=document.getElementsByClassName("autocomplete-items"),d=0;d<c.length;d++)b!=c[d]&&b!=a&&c[d].parentNode.removeChild(c[d])}var g;a.addEventListener("input",function(){var d,e,h=this.value;if(f(),!h)return!1;g=-1,d=document.createElement("DIV"),d.setAttribute("id",this.id+"autocomplete-list"),d.setAttribute("class","autocomplete-items"),this.parentNode.appendChild(d);var i=[];for(const[b,g]of Object.entries(c))g.substr(0,h.length).toUpperCase()==h.toUpperCase()?(i.push("found"),e=document.createElement("DIV"),e.innerHTML="<strong>"+g.substr(0,h.length)+"</strong>",e.innerHTML+=g.substr(h.length),e.innerHTML+=`<input type='hidden' value="${g}" data-slug='${b}'> `,e.addEventListener("click",function(){let b=this.getElementsByTagName("input")[0];a.value=b.value,a.closest("input").nextElementSibling.value=b.dataset.slug,f()}),d.appendChild(e)):i.push("notfound");-1==i.indexOf("found")&&(e=document.createElement("DIV"),e.innerHTML+="Not Found",e.innerHTML+="<input type='hidden' value=''>",e.addEventListener("click",function(){a.value=this.getElementsByTagName("input")[0].value,f()}),d.appendChild(e))}),a.addEventListener("keydown",function(a){var b=document.getElementById(this.id+"autocomplete-list");b&&(b=b.getElementsByTagName("div")),40==a.keyCode?(g++,d(b)):38==a.keyCode?(g--,d(b)):13==a.keyCode&&(a.preventDefault(),-1<g&&b&&b[g].click())}),document.addEventListener("click",function(a){f(a.target)})}const d=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});a(document).on("click","#tf-single-hotel-avail .tf-submit",function(b){if(b.preventDefault(),""==a.trim(a("input[name=check-in-out-date]").val()))return void(0===a("#tf-required").length&&a(".tf_booking-dates .tf_label-row").append("<span id=\"tf-required\" clss=\"required\"><b>"+tf_params.field_required+"</b></span>"));var c=a("input[name=tf_room_avail_nonce]").val(),d=a("input[name=post_id]").val(),e=a("select[name=adults] option").filter(":selected").val(),f=a("select[name=children] option").filter(":selected").val(),g=a("input[name=check-in-out-date]").val();jQuery.ajax({url:tf_params.ajax_url,type:"post",data:{action:"tf_room_availability",tf_room_avail_nonce:c,post_id:d,adult:e,child:f,check_in_out:g},success:function(b){a("html, body").animate({scrollTop:a("#rooms").offset().top},500),a("#rooms").html(b)},error:function(a,b){var c="";if(0===a.status)var c="Not connect.\n Verify Network.";else if(404==a.status)var c="Requested page not found. [404]";else if(500==a.status)var c="Internal Server Error [500].";else if("parsererror"===b)var c="Requested JSON parse failed.";else if("timeout"===b)var c="Time out error.";else if("abort"===b)var c="Ajax request aborted.";else var c="Uncaught Error.\n"+a.responseText;alert(c)}})}),a(document).on("click",".hotel-room-availability",function(b){b.preventDefault(),a("html, body").animate({scrollTop:a("#tf-single-hotel-avail").offset().top},500)}),a(document).on("click",".hotel-room-book",function(b){b.preventDefault();var c=a(this),d=a("input[name=tf_room_booking_nonce]").val(),e=a("input[name=post_id]").val(),f=a(this).closest(".room-submit-wrap").find("input[name=room_id]").val(),g=a(this).closest(".room-submit-wrap").find("input[name=unique_id]").val(),h=a("input[name=place]").val(),i=a("input[name=adult]").val(),j=a("input[name=child]").val(),k=a("input[name=check_in_date]").val(),l=a("input[name=check_out_date]").val(),m=a(this).closest(".reserve").find("select[name=hotel_room_selected] option").filter(":selected").val();a.ajax({type:"post",url:tf_params.ajax_url,data:{action:"tf_hotel_booking",tf_room_booking_nonce:d,post_id:e,room_id:f,unique_id:g,location:h,adult:i,child:j,check_in_date:k,check_out_date:l,room:m},beforeSend:function(){c.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),a(".tf_notice_wrapper").html("").hide()},complete:function(){c.unblock()},success:function(b){c.unblock();var d=JSON.parse(b);if("error"==d.status){var e="";return d.errors&&d.errors.forEach(function(a){e+="<div class=\"woocommerce-error\">"+a+"</div>"}),a(".tf_notice_wrapper").html(e).show(),a("html, body").animate({scrollTop:0},300),!1}d.redirect_to?window.location.replace(d.redirect_to):jQuery(document.body).trigger("added_to_cart")},error:function(a){console.log(a)}})}),a("[data-fancybox=\"hotel-gallery\"]").fancybox({loop:!0,buttons:["zoom","slideShow","fullScreen","close"],hash:!1});var e=a(".swiper-button-prev"),f=a(".swiper-button-next");a(".single-slider-wrapper .tf_slider-for").slick({slide:".slick-slide-item",slidesToShow:1,slidesToScroll:1,arrows:!1,fade:!1,dots:!1,centerMode:!1,variableWidth:!1}),e.on("click",function(){a(this).closest(".single-slider-wrapper").find(".tf_slider-for").slick("slickPrev")}),f.on("click",function(){a(this).closest(".single-slider-wrapper").find(".tf_slider-for").slick("slickNext")}),a(".reserve-button a").click(function(){a("html, body").animate({scrollTop:a("#rooms").offset().top-32},1e3)}),a(document).on("submit","form.tf_tours_booking",function(b){b.preventDefault();var c=a(this),d=new FormData(this);d.append("action","tf_tours_booking");var e=0;jQuery(".tour-extra-single input:checkbox:checked").each(function(){e+=isNaN(parseInt(jQuery(this).val()))?0:parseInt(jQuery(this).val())}),d.append("tour_extra_total",e);var f=a(".tour-extra-single input:checkbox:checked").map(function(){return a(this).data("title")}).get();d.append("tour_extra_title",f),a.ajax({type:"post",url:tf_params.ajax_url,data:d,processData:!1,contentType:!1,beforeSend:function(){c.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),a(".tf_notice_wrapper").html("").hide()},complete:function(){c.unblock()},success:function(b){c.unblock();var d=JSON.parse(b);if("error"==d.status){var e="";return d.errors&&d.errors.forEach(function(a){e+="<div class=\"woocommerce-error\">"+a+"</div>"}),a(".tf_notice_wrapper").html(e).show(),a("html, body").animate({scrollTop:0},300),!1}d.redirect_to?window.location.replace(d.redirect_to):jQuery(document.body).trigger("added_to_cart");console.log(d)},error:function(a){console.log(a)}})}),a("[data-fancybox=\"tour-gallery\"]").fancybox({loop:!0,buttons:["zoom","slideShow","fullScreen","close"],hash:!1}),a(".tf-single-tour-pricing .tf-price-tab li").click(function(){var b=a(this).attr("id");a(this).addClass("active").siblings().removeClass("active"),a(".tf-price").addClass("tf-d-n"),a("."+b+"-price").removeClass("tf-d-n")});var g;const h=()=>{var b=a("#tf-place").val(),c=a("#adults").val(),e=a("#room").val(),f=a("#children").val(),h=a("#check-in-out-date").val(),i=h.split(" to "),j=i[0],k=i[1],l=a(".tf-post-type").val(),m=[];a("[name*=tf_filters]").each(function(){a(this).is(":checked")&&m.push(a(this).val())});var m=m.join(),n=[];a("[name*=tf_features]").each(function(){a(this).is(":checked")&&n.push(a(this).val())});var n=n.join(),o=new FormData;o.append("action","tf_trigger_filter"),o.append("type",l),o.append("dest",b),o.append("adults",c),o.append("room",e),o.append("children",f),o.append("checkin",j),o.append("checkout",k),o.append("filters",m),o.append("features",n),o.append("checked",h),g&&4!=g.readyState&&g.abort(),g=a.ajax({type:"post",url:tf_params.ajax_url,data:o,processData:!1,contentType:!1,beforeSend:function(){a(".archive_ajax_result").block({message:null,overlayCSS:{background:"#fff",opacity:.5}})},complete:function(){a(".archive_ajax_result").unblock()},success:function(b){a(".archive_ajax_result").unblock(),a(".archive_ajax_result").html(b),d.success(tf_params.ajax_result_success)},error:function(a){console.log(a)}})};a(document).on("submit","#tf-widget-booking-search",function(a){a.preventDefault(),h()}),a(document).on("change","[name*=tf_filters],[name*=tf_features]",function(){h()}),a.fn.inViewport=function(c){return this.each(function(d,e){function f(){var d=a(this).height(),f=e.getBoundingClientRect(),g=f.top,h=f.bottom;return c.call(e,Math.max(0,0<g?d-g:h<d?h:d))}f(),a(b).on("resize scroll",f)})},a(window).load(function(){jQuery("[data-width]").each(function(){var a=jQuery(this),b=a.attr("data-width");a.inViewport(function(c){0<c?a.css("width",+b+"%"):a.css("width","0%")})})}),a(".share-toggle[data-toggle=\"true\"]").click(function(b){b.preventDefault();var c=a(this).attr("href");a(c).slideToggle("fast")}),a("button#share_link_button").click(function(){a(this).addClass("copied"),setTimeout(function(){a("button#share_link_button").removeClass("copied")},3e3),a(this).parent().find("#share_link_input").select(),document.execCommand("copy")}),a(".faq-head").click(function(){a(this).parent().toggleClass("active").find(".faq-content").slideToggle("fast")}),a(".itinerary-head").on("click",function(){a(this).parent().toggleClass("active").find(".itinerary-content").slideToggle("fast")}),a(".tf-suggestion-items-wrapper").slick({dots:!0,arrows:!1,infinite:!0,speed:300,autoplaySpeed:2e3,slidesToShow:3,slidesToScroll:1,responsive:[{breakpoint:1024,settings:{slidesToShow:3,slidesToScroll:1,infinite:!0,dots:!0}},{breakpoint:600,settings:{slidesToShow:2,slidesToScroll:1}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1}}]}),a(".tf-review-items-wrapper").slick({dots:!0,arrows:!1,infinite:!0,speed:300,autoplay:!0,autoplaySpeed:2e3,slidesToShow:4,slidesToScroll:1,responsive:[{breakpoint:1024,settings:{slidesToShow:4,slidesToScroll:1,infinite:!0,dots:!0}},{breakpoint:600,settings:{slidesToShow:3,slidesToScroll:1}},{breakpoint:480,settings:{slidesToShow:2,slidesToScroll:1}}]});const i="wishlist_item",j=()=>{let a=localStorage.getItem(i);return null===a?[]:JSON.parse(a)},k=a=>{let b=j();return!(0!==b.filter(b=>b.post==a.post).length)&&(b.push(a),localStorage.setItem(i,JSON.stringify(b)),!0)},l=()=>{let b=a(".tf-wishlist-holder");a.each(b,function(b,c){let d=a(c).data("type");d=d?d.split(","):void 0;let e=j();d!==void 0&&(e=e.filter(a=>d.includes(a.type)));let f=e.map(a=>a.post),g={nonce:a(c).data("nonce"),action:"tf_generate_table",ids:f};a.post(tf_params.ajax_url,g,function(b){b.success&&a(c).html(b.data)})})},m=a=>{let b=j(),c=b.findIndex(b=>b.post==a);return console.log(c,a,b),!!(0<=c)&&(b.splice(c,1),console.log(b),localStorage.setItem(i,JSON.stringify(b)),"1"!=tf_params.single&&l(),!0)},n=a=>{a.addClass("remove-wishlist"),a.addClass("fas"),a.addClass("tf-text-red"),a.removeClass("far"),a.removeClass("add-wishlist")},o=a=>{a.addClass("add-wishlist"),a.addClass("far"),a.removeClass("fas"),a.removeClass("tf-text-red"),a.removeClass("remove-wishlist")};a(document).on("click",".add-wishlist",function(){let b=a(".add-wishlist"),c={type:b.data("type"),post:b.data("id")},e=b.data("page-title"),f=b.data("page-url"),g=void 0===f?"":"<a class=\"wish-button\" href=\""+f+"\">"+e+"</a>";return a("body").hasClass("logged-in")?(c.action="tf_add_to_wishlists",c.nonce=b.data("nonce"),a.ajax({type:"post",url:tf_params.ajax_url,data:c,beforeSend:function(){d.success(tf_params.wishlist_add)},success:function(a){a.success&&(n(b),d.success({message:a.data+g,duration:4e3}))}})):!0===k(c)?(d.success(tf_params.wishlist_add),n(b),d.success({message:tf_params.wishlist_added+g,duration:4e3})):d.error(tf_params.wishlist_add_error),!1}),a("body").find(".tf-wishlist-holder").length&&l(),a(document).on("click",".remove-wishlist",function(){let b=a(".remove-wishlist"),c=b.data("id");if(a("body").hasClass("logged-in")){let e=b.closest("table"),f=e.data("type"),g={id:c,action:"tf_remove_wishlist",type:f,nonce:b.data("nonce")};a.get(tf_params.ajax_url,g,function(a){a.success&&("1"!=tf_params.single&&e.closest(".tf-wishlists").html(a.data),o(b),d.success(tf_params.wishlist_removed))})}else!0==m(c)?(o(b),d.success(tf_params.wishlist_removed)):d.error(tf_params.wishlist_remove_error)}),(()=>{if(!a(document).hasClass("logged-in")&&a(document).find(".add-wishlist")){let c=a(".add-wishlist"),d=c.data("id"),e=j();var b=e.findIndex(a=>a.post==d);0<=b?n(c):o(c)}})();var p=document.getElementById("tf-location"),q=tf_params.locations;p&&c(p,q);var r=document.getElementById("tf-destination"),s=tf_params.tour_destinations;r&&c(r,s),a(window).scroll(function(){var b=a(".tf-tour-booking-wrap"),c=a(window).scrollTop();800<=c?b.addClass("tf-tours-fixed"):b.removeClass("tf-tours-fixed")}),a(document).on("click",".tf_selectperson-wrap .tf_input-inner,.tf_person-selection-wrap .tf_person-selection-inner",function(){a(".tf_acrselection-wrap").slideToggle("fast")}),jQuery(document).on("click",function(a){jQuery(a.target).closest(".tf_selectperson-wrap").length||jQuery(".tf_acrselection-wrap").slideUp("fast")}),a(".acr-inc").on("click",function(){var b=a(this).parent().find("input");b.val(parseInt(b.val())+1).change()}),a(".acr-dec").on("click",function(){var b=a(this).parent().find("input"),c=b.attr("min");b.val()>c&&b.val(b.val()-1).change()}),a(document).on("change","#adults",function(){var b=a(this).val();1<b?a(".adults-text").text(b+" "+tf_params.adult):a(".adults-text").text(b+" "+tf_params.adult)}),a(document).on("change","#children",function(){var b=a(this).val();1<b?a(".child-text").text(b+" "+tf_params.children):a(".child-text").text(b+" "+tf_params.children)}),a(document).on("change","#infant",function(){var b=a(this).val();1<b?a(".infant-text").text(b+" "+tf_params.infant):a(".infant-text").text(b+" "+tf_params.infant)}),a(document).on("change","#room",function(){var b=a(this).val();1<b?a(".room-text").text(b+" "+tf_params.room):a(".room-text").text(b+" "+tf_params.room)}),a(document).on("click","#reply-title",function(){var b=a(this);a("#commentform").slideToggle("fast","swing",function(){b.parent().toggleClass("active")})}),a(document).on("click","#tf-ask-question-trigger",function(b){b.preventDefault(),a("#tf-ask-question").fadeIn().find(".response").html("")}),a(document).on("click","span.close-aq",function(){a("#tf-ask-question").fadeOut()}),a(document).on("submit","form#ask-question",function(b){b.preventDefault();var c=a(this),d=new FormData(this);d.append("action","tf_ask_question"),a.ajax({type:"post",url:tf_params.ajax_url,data:d,processData:!1,contentType:!1,beforeSend:function(){c.block({message:null,overlayCSS:{background:"#fff",opacity:.5}}),c.find(".response").html(tf_params.sending_ques)},complete:function(){c.unblock()},success:function(a){c.unblock();var b=JSON.parse(a);"sent"==b.status?(c.find(".response").html(b.msg),c.find("[type=\"reset\"]").trigger("click")):c.find(".response").html(b.msg)},error:function(a){console.log(a)}})}),a(document).on("click",".change-view",function(b){b.preventDefault(),a(".change-view").removeClass("active"),a(this).addClass("active");var c=a(this).data("id");"grid-view"==c?a(".archive_ajax_result").addClass("tours-grid"):a(".archive_ajax_result").removeClass("tours-grid")});var t,u=!1,v=function(b){t&&4!=t.readyState&&t.abort(),t=a.ajax({url:b,contentType:!1,processData:!1,asynch:!0,beforeSend:function(){a(document).find(".tf_posts_navigation").addClass("loading"),u=!0},success:function(b){a(".archive_ajax_result").append(a(".archive_ajax_result",b).html()),a(".tf_posts_navigation").html(a(".tf_posts_navigation",b).html()),u=!1,a(document).find(".tf_posts_navigation").removeClass("loading")}})};a(document).on("click",".tf_posts_navigation a.next.page-numbers",function(b){b.preventDefault();var c=b.target.href?b.target.href:a(this).context.href;v(c),window.history.pushState({url:""+c+""},"",c)}),a(window).on("scroll",function(){a(".tf_posts_navigation a.next.page-numbers").each(function(c,d){var e=a(this),f=a(window).height(),g=d.getBoundingClientRect(),h=g.top,i=g.bottom,b=parseInt(h-f/2);!1===u&&f>=b&&e.trigger("click")})}),a(".tf-travel-text h4").click(function(){a(this).siblings(".tf-travel-contetn").slideToggle(),a(this).parents(".tf-travel-itinerary-item").siblings().find(".tf-travel-contetn").slideUp()}),a(".tf-faq-title").click(function(){a(this).siblings(".tf-faq-desc").slideToggle(),a(this).parents(".tf-faq-item").siblings().find(".tf-faq-desc").slideUp()}),a(".tf-header-menu-triger").click(function(){a(".tf-header-menu-wrap").slideToggle()})})})(jQuery,window);function tfOpenForm(a,b){var c,d,e;for(d=document.getElementsByClassName("tf-tabcontent"),c=0;c<d.length;c++)d[c].style.display="none";for(e=document.getElementsByClassName("tf-tablinks"),c=0;c<e.length;c++)e[c].className=e[c].className.replace(" active","");document.getElementById(b).style.display="block",document.getElementById(b).style.transition="all 0.2s",a.currentTarget.className+=" active"}jQuery("#tf-hotel-booking-form").css("display","block");function tf_load_rating(){jQuery("#commentform").show()} -
tourfic/trunk/inc/enqueues.php
r2715826 r2742744 55 55 * v4.6.13 56 56 */ 57 if ( $flatpickr_cdn == true) {57 if ( $flatpickr_cdn == true && defined( 'TF_PRO' ) ) { 58 58 wp_enqueue_style( 'flatpickr', '//cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.13/flatpickr.min.css', array(), '4.6.13' ); 59 59 wp_enqueue_script( 'flatpickr', '//cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.13/flatpickr.min.js', array( 'jquery' ), '4.6.13', true ); … … 75 75 * v3.5.7 76 76 */ 77 if ( $fancy_cdn == true) {77 if ( $fancy_cdn == true && defined( 'TF_PRO' ) ) { 78 78 wp_enqueue_style( 'fancyBox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css', array(), '3.5.7' ); 79 79 wp_enqueue_script( 'fancyBox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js', array( 'jquery' ), '3.5.7', true ); … … 88 88 * v1.8.1 89 89 */ 90 if ( $slick_cdn == true) {90 if ( $slick_cdn == true && defined( 'TF_PRO' ) ) { 91 91 wp_enqueue_style( 'slick', '//cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css', array(), '1.8.1' ); 92 92 wp_enqueue_script( 'slick', '//cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js', array( 'jquery' ), '1.8.1', true ); … … 101 101 * v5.15.4 102 102 */ 103 if ( $fa_cdn == true) {103 if ( $fa_cdn == true && defined( 'TF_PRO' ) ) { 104 104 wp_enqueue_style( 'font-awesome-5', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css', '', '5.15.4' ); 105 105 } else { -
tourfic/trunk/inc/functions.php
r2715826 r2742744 4 4 5 5 /** 6 * WC Product Extend 7 */ 8 if ( file_exists( TF_INC_PATH . 'functions/woocommerce/wc-product-extend.php' ) ) { 9 function fida() { 10 require_once TF_INC_PATH . 'functions/woocommerce/wc-product-extend.php'; 11 } 12 add_action( 'init', 'fida' ); 13 } else { 14 tf_file_missing(TF_INC_PATH . 'functions/woocommerce/wc-product-extend.php'); 15 } 16 17 /** 6 18 * Helper Functions 7 19 */ … … 66 78 } else { 67 79 tf_file_missing(TF_INC_PATH . 'enqueues.php'); 68 }69 70 /**71 * SVG72 *73 * @since 1.074 */75 if ( file_exists( TF_INC_PATH . 'functions/svg-icons.php' ) ) {76 require_once TF_INC_PATH . 'functions/svg-icons.php';77 } else {78 tf_file_missing(TF_INC_PATH . 'functions/svg-icons.php');79 80 } 80 81 … … 384 385 385 386 // Get post type 386 $post_type = isset( $_GET['type'] ) ? $_GET['type'] :'';387 $post_type = $_GET['type'] ?? ''; 387 388 388 389 if(!empty($post_type)){ … … 392 393 393 394 $place_key = 'place'; 394 $place_value = isset($_GET[$place_key]) ? $_GET[$place_key] :'';395 $place_value = $_GET[ $place_key ] ?? ''; 395 396 396 397 $taxonomy = $post_type == 'tf_hotel' ? 'hotel_location' : 'tour_destination'; 397 398 $place_name = !empty($place_value) ? get_term_by( 'slug', $place_value , $taxonomy)->name : ''; 398 399 399 $ adult = isset($_GET['adults']) ? $_GET['adults'] :0;400 $children = isset($_GET['children']) ? $_GET['children'] : 0;401 $room = isset($_GET['room']) ? $_GET['room'] : 0; 402 $date = isset($_GET['check-in-out-date']) ? $_GET['check-in-out-date'] : '';403 404 }400 $room = $_GET['room'] ?? 0; 401 } 402 403 $adult = $_GET['adults'] ?? 0; 404 $children = $_GET['children'] ?? 0; 405 $date = $_GET['check-in-out-date'] ?? ''; 405 406 406 407 ?> … … 413 414 <div class="tf_form-inner"> 414 415 <i class="fas fa-map-marker-alt"></i> 415 <input type="text" id="<?php echo $place_input_id ; ?>" required="" class="" placeholder="<?php echo $place_placeholder; ?>" value="<?php echo $place_name; ?>">416 <input type="hidden" name="place" id="tf-place" value="<?php echo $place_value ; ?>"/>416 <input type="text" id="<?php echo $place_input_id ?? ''; ?>" required="" class="" placeholder="<?php echo $place_placeholder ?? __('Location/Destination', 'tourfic'); ?>" value="<?php echo $place_name ?? ''; ?>"> 417 <input type="hidden" name="place" id="tf-place" value="<?php echo $place_value ?? ''; ?>"/> 417 418 </div> 418 419 </label> … … 450 451 </label> 451 452 </div> 452 <?php if ($post_type !== 'tf_tours') { ?>453 <?php if ($post_type == 'tf_hotel') { ?> 453 454 <div class="tf_form-row"> 454 455 <label class="tf_label-row"> … … 480 481 <div class="tf_form-row"> 481 482 <?php 482 $ptype = isset( $_GET['type'] ) ? $_GET['type'] :get_post_type();483 $ptype = $_GET['type'] ?? get_post_type(); 483 484 ?> 484 485 <input type="hidden" name="type" value="<?php echo $ptype; ?>" class="tf-post-type" /> … … 648 649 $features = ( $_POST['features'] ) ? explode(',', sanitize_text_field( $_POST['features'] )) : null; 649 650 $posttype = $_POST['type'] ? sanitize_text_field( $_POST['type'] ): 'tf_hotel'; 650 // @KK separate texonomy input for filter query651 # Separate taxonomy input for filter query 651 652 $place_taxonomy = $posttype == 'tf_tours' ? 'tour_destination' : 'hotel_location'; 652 653 $filter_taxonomy = $posttype == 'tf_tours' ? 'null' : 'hotel_feature'; 653 // @KK take dates for filter query654 # Take dates for filter query 654 655 $checkin = isset($_POST['checkin']) ? trim($_POST['checkin']) : null; 655 656 $checkout = isset($_POST['checkout']) ? trim($_POST['checkout']) : null; 656 // Propertise args 657 if(!empty($checkin) && !empty($checkout)) { 658 $period = new DatePeriod( 659 new DateTime( $checkin ), 660 new DateInterval( 'P1D' ), 661 new DateTime( $checkout . '23:59' ) 662 ); 663 } else { 664 $period = ''; 665 } 666 667 // Properties args 657 668 $args = array( 658 669 'post_type' => $posttype, … … 669 680 'orderby' => 'name', 670 681 'order' => 'ASC', 671 'hide_empty' => 0, //can be 1, '1' too672 'hierarchical' => 0, //can be 1, '1' too682 'hide_empty' => 0, 683 'hierarchical' => 0, 673 684 'slug' => sanitize_title($search, ''), 674 685 ) ); … … 728 739 $args['tax_query']['tf_feature']['relation'] = 'AND'; 729 740 730 foreach ( $filters as $key => $term_id) {741 foreach ( $filters as $key => $term_id ) { 731 742 $args['tax_query']['tf_feature'][] = array( 732 743 'taxonomy' => 'tf_feature', 733 'terms' => array( $term_id),744 'terms' => array( $term_id ), 734 745 ); 735 746 } … … 738 749 739 750 } 740 // @KK Add meta if dates exists and post type is tours 741 if ($checkin && $checkout && $posttype == ' tf_tours'){ 751 752 # Add meta if dates exists and post type is tours 753 if ( $checkin && $checkout && $posttype == ' tf_tours' ){ 754 742 755 $args['tax_query']['relation'] = $relation; 743 756 $args['meta_query'] = array( 744 757 array( 745 758 'key' => 'tf_tours_option', 746 'value' => str_replace( '-', '/', $checkin),759 'value' => str_replace( '-', '/', $checkin ), 747 760 'compare' => 'LIKE', 748 761 ), 749 762 array( 750 763 'key' => 'tf_tours_option', 751 'value' => str_replace( '-', '/', $checkout),764 'value' => str_replace( '-', '/', $checkout ), 752 765 'compare' => 'LIKE', 753 766 ), 754 ); 755 } 756 $loop = new WP_Query( $args ); ?> 757 <?php 767 ); 768 769 } 770 771 $loop = new WP_Query( $args ); 772 758 773 if ( $loop->have_posts() ) { 774 $not_found = []; 759 775 while ( $loop->have_posts() ) { 760 776 … … 762 778 763 779 if( $posttype == 'tf_hotel' ){ 764 tf_hotel_archive_single_item($adults, $child, $room, $check_in_out); 780 781 if( empty( $check_in_out ) ) { 782 783 $not_found[] = 0; 784 tf_hotel_archive_single_item(); 785 786 } else { 787 788 $data = [$adults, $child, $room, $check_in_out]; 789 tf_filter_hotel_by_date( $period,$not_found, $data); 790 791 } 792 765 793 }else{ 766 tf_tour_archive_single_item($adults, $child, $check_in_out); 794 795 if( empty( $check_in_out ) ) { 796 797 $not_found[] = 0; 798 tf_tour_archive_single_item(); 799 800 } else { 801 802 $data = [$adults, $child, $check_in_out]; 803 tf_filter_tour_by_date( $period, $not_found, $data ); 804 805 } 806 767 807 } 768 808 } 809 810 if (!in_array(0, $not_found)) { 811 echo '<div class="tf-nothing-found">'. __('Nothing Found!', 'tourfic').'</div>'; 812 } 813 769 814 } else { 770 echo '<div class="tf-nothing-found">Nothing Found!</div>'; 771 } 815 816 echo '<div class="tf-nothing-found">'. __('Nothing Found!', 'tourfic').'</div>'; 817 818 } 819 772 820 wp_reset_postdata(); 773 821 … … 776 824 777 825 826 778 827 /** 779 828 * Migrate data from v2.0.4 to v2.1.0 … … 782 831 */ 783 832 function tf_migrate_data() { 833 784 834 if ( get_option( 'tf_migrate_data_204_210' ) < 1 ) { 785 835 … … 875 925 ); 876 926 } 927 877 928 /** Tour Destinations Image Fix */ 878 929 $tour_destinations = get_terms([ … … 905 956 } 906 957 } 958 907 959 /** Tour Type Fix */ 908 960 $tours = get_posts(['post_type' => 'tf_tours', 'numberposts' => -1,]); … … 922 974 flush_rewrite_rules(true); 923 975 update_option('tf_migrate_data_204_210', 1); 976 924 977 } 978 925 979 } 926 980 add_action( 'init', 'tf_migrate_data' ); -
tourfic/trunk/inc/functions/functions-helper.php
r2715826 r2742744 6 6 * Search form action url 7 7 */ 8 function tf_booking_search_action() {8 function tf_booking_search_action() { 9 9 10 10 // get data from global settings else default 11 $search_result_action = !empty( tfopt('search-result-page')) ? get_permalink(tfopt('search-result-page')) : home_url('/search-result/');11 $search_result_action = !empty( tfopt( 'search-result-page' ) ) ? get_permalink( tfopt( 'search-result-page' ) ) : home_url( '/search-result/' ); 12 12 // can be override by filter 13 13 return apply_filters( 'tf_booking_search_action', $search_result_action ); … … 15 15 } 16 16 17 // Protected Pass 18 function tourfic_proctected_product_pass(){ 19 return "111111"; 20 } 21 22 // Notice wrapper 23 function tourfic_notice_wrapper(){ 17 /** 18 * Notice wrapper 19 */ 20 function tourfic_notice_wrapper() { 24 21 ?> 25 22 <div class="tf_container"> … … 35 32 * @return number of available terms 36 33 */ 37 if( !function_exists('tf_term_count') ) {38 function tf_term_count( $filter, $destination, $default_count ) {34 if( !function_exists('tf_term_count') ) { 35 function tf_term_count( $filter, $destination, $default_count ) { 39 36 40 37 if( $destination == '' ){ … … 70 67 endif; 71 68 72 return count( $term_count);69 return count( $term_count ); 73 70 74 71 wp_reset_postdata(); … … 76 73 } 77 74 78 // Set search reult page 79 function tourfic_booking_set_search_result( $url ){ 75 /** 76 * Set search reult page 77 */ 78 function tourfic_booking_set_search_result( $url ) { 79 80 80 $search_result_page = tfopt( 'search-result-page' ); 81 81 82 if ( isset( $search_result_page ) ) {82 if ( isset( $search_result_page ) ) { 83 83 $url = get_permalink( $search_result_page ); 84 84 } … … 86 86 return $url; 87 87 88 89 90 88 } 91 89 add_filter( 'tf_booking_search_action', 'tourfic_booking_set_search_result' ); … … 93 91 // Tours price with html format 94 92 function tf_tours_price_html() { 93 95 94 $meta = get_post_meta( get_the_ID(),'tf_tours_option',true ); 96 95 $pricing_rule = $meta['pricing'] ? $meta['pricing'] : null; … … 129 128 * Full Width Container Start 130 129 */ 131 function tourfic_fullwidth_container_start( $fullwidth ) {130 function tourfic_fullwidth_container_start( $fullwidth ) { 132 131 133 132 if ( $fullwidth == "true" ) : ?> … … 136 135 <div class="tf_custom-container"> 137 136 <div class="tf_custom-inner"> 137 138 138 <?php endif; 139 139 } 140 140 141 141 /** 142 * Full Width Container Start143 */ 144 function tourfic_fullwidth_container_end( $fullwidth ) {142 * Full Width Container End 143 */ 144 function tourfic_fullwidth_container_end( $fullwidth ) { 145 145 146 146 if ( $fullwidth == "true" ) : ?> … … 150 150 } 151 151 152 // Ask Question 153 function tourfic_ask_question(){ 152 /** 153 * Ask Question 154 */ 155 function tourfic_ask_question() { 154 156 ?> 155 157 <div id="tf-ask-question" style="display: none;"> … … 184 186 add_action( 'wp_footer', 'tourfic_ask_question' ); 185 187 186 // Ask question ajax 187 function tourfic_ask_question_ajax(){ 188 /** 189 * Ask question ajax 190 */ 191 function tourfic_ask_question_ajax() { 192 188 193 $response = array(); 189 194 … … 262 267 */ 263 268 function tf_tours_excerpt_more( $more ) { 269 264 270 if( 'tf_tours' === get_post_type()) 265 return '.....'; 271 return '...'; 272 266 273 } 267 274 add_filter( 'excerpt_more', 'tf_tours_excerpt_more' ); … … 274 281 */ 275 282 function tf_custom_excerpt_length( $length ) { 283 276 284 if( 'tf_tours' === get_post_type()) 277 285 return 30; 286 278 287 } 279 288 add_filter( 'excerpt_length', 'tf_custom_excerpt_length', 999 ); 280 289 281 // Pagination 282 function tourfic_posts_navigation($wp_query=''){ 290 /** 291 * Pagination 292 */ 293 function tourfic_posts_navigation($wp_query='') { 294 283 295 if(empty($wp_query)) { 284 296 global $wp_query; 285 297 } 298 286 299 $max_num_pages = $wp_query->max_num_pages; 287 300 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; … … 297 310 ) ); 298 311 echo "</div>"; 312 299 313 } 300 314 … … 342 356 echo 'locale: "' .$flatpickr_locale. '",'; 343 357 } 344 } 358 359 } 360 } 361 362 /** 363 * Flatten a multi-dimensional array into a single level. 364 * 365 * @author devkabir 366 * 367 * @param iterable $array 368 * @param int $depth 369 * @return array 370 */ 371 if (!function_exists('tf_array_flatten')) { 372 function tf_array_flatten($array, $depth = INF) { 373 374 $result = []; 375 376 foreach ($array as $item) { 377 if (!is_array($item)) { 378 $result[] = $item; 379 } else { 380 $values = $depth === 1 381 ? array_values($item) 382 : tf_array_flatten($item, $depth - 1); 383 384 foreach ($values as $value) { 385 $result[] = $value; 386 } 387 } 388 } 389 390 return $result; 391 392 } 345 393 } 346 394 ?> -
tourfic/trunk/inc/functions/functions-hotel.php
r2715826 r2742744 1 1 <?php 2 //don't load directly2 # don't load directly 3 3 defined( 'ABSPATH' ) || exit; 4 4 … … 54 54 'has_archive' => true, 55 55 'hierarchical' => false, 56 'menu_position' => 2 5,56 'menu_position' => 26.2, 57 57 'supports' => apply_filters( 'tf_hotel_supports', array( 'title', 'editor', 'thumbnail', 'comments', 'author' ) ), 58 58 ); … … 262 262 * Ajax hotel room availability 263 263 * 264 * @author fida 264 265 */ 265 266 add_action( 'wp_ajax_tf_room_availability', 'tf_room_availability_callback' ); … … 272 273 } 273 274 274 $form_post_id = isset($_POST['post_id']) ? sanitize_text_field($_POST['post_id']) : ''; 275 $form_adult = isset($_POST['adult']) ? sanitize_text_field($_POST['adult']) : ''; 276 $form_child = isset($_POST['child']) ? sanitize_text_field($_POST['child']) : ''; 275 /** 276 * Form data 277 */ 278 $form_post_id = !empty( $_POST['post_id'] ) ? sanitize_text_field( $_POST['post_id'] ) : ''; 279 $form_adult = !empty( $_POST['adult'] ) ? sanitize_text_field( $_POST['adult'] ) : 0; 280 $form_child = !empty( $_POST['child'] ) ? sanitize_text_field( $_POST['child'] ) : 0; 281 $form_check_in_out = !empty( $_POST['check_in_out'] ) ? sanitize_text_field( $_POST['check_in_out'] ) : ''; 277 282 $form_total_person = $form_adult + $form_child; 278 $form_check_in_out = isset($_POST['check_in_out']) ? sanitize_text_field($_POST['check_in_out']) : '';279 283 if ($form_check_in_out) { 280 $form_check_in = substr($form_check_in_out,0,10); 281 $form_check_in_stt = strtotime($form_check_in); 282 $form_check_out = substr($form_check_in_out,14,10); 283 $form_check_out_stt = strtotime($form_check_out); 284 list( $form_start, $form_end ) = explode( ' to ', $form_check_in_out ); 284 285 } 285 286 287 /** 288 * Backend data 289 */ 286 290 $meta = get_post_meta( $form_post_id, 'tf_hotel', true ); 287 291 $rooms = !empty($meta['room']) ? $meta['room'] : ''; 288 292 $locations = get_the_terms( $form_post_id, 'hotel_location' ); 289 if ($locations) { 290 $first_location_name = $locations[0]->name; 291 } 293 $first_location_name = !empty( $locations ) ? $locations[0]->name : ''; 294 295 // start table 296 ob_start(); 292 297 ?> 293 298 294 <div class="listing-title"> 295 <h4><?php esc_html_e( 'Availability', 'tourfic' ); ?></h4> 296 </div> 297 <div class="tf_room-table hotel-room-wrap"> 298 <table class="availability-table"> 299 <thead> 300 <tr> 301 <th class="description"><?php _e( 'Room Details', 'tourfic' ); ?></th> 302 <th class="pax"><?php _e( 'Pax', 'tourfic' ); ?></th> 303 <th class="pricing"><?php _e( 'Price', 'tourfic' ); ?></th> 304 <th class="reserve"><?php _e( 'Select Rooms', 'tourfic' ); ?></th> 305 </tr> 306 </thead> 307 <tbody> 308 <!-- Start Single Room --> 309 <?php 310 if(!empty($rooms)) { 311 $room_id = -1; 312 foreach ($rooms as $room) { 313 314 $room_id++; 315 316 $enable = !empty($room['enable']) ? $room['enable'] : ''; 317 318 // Check if room is enabled 319 if ($enable == '1') { 320 321 $footage = !empty($room['footage']) ? $room['footage'] : ''; 322 $bed = !empty($room['bed']) ? $room['bed'] : ''; 323 $adult_number = !empty($room['adult']) ? $room['adult'] : '0'; 324 $child_number = !empty($room['child']) ? $room['child'] : '0'; 325 $total_person = $adult_number + $child_number; 326 $pricing_by = !empty($room['pricing-by']) ? $room['pricing-by'] : ''; 327 $b_check_in = !empty($room['availability']['from']) ? $room['availability']['from'] : ''; 328 if($b_check_in) { 329 $b_check_in_stt = strtotime($b_check_in); 299 <div class="listing-title"> 300 <h4><?php esc_html_e( 'Availability', 'tourfic' ); ?></h4> 301 </div> 302 <div class="tf_room-table hotel-room-wrap"> 303 <table class="availability-table"> 304 <thead> 305 <tr> 306 <th class="description"><?php _e( 'Room Details', 'tourfic' ); ?></th> 307 <th class="pax"><?php _e( 'Pax', 'tourfic' ); ?></th> 308 <th class="pricing"><?php _e( 'Price', 'tourfic' ); ?></th> 309 <th class="reserve"><?php _e( 'Select Rooms', 'tourfic' ); ?></th> 310 </tr> 311 </thead> 312 <tbody> 313 <?php 314 echo ob_get_clean(); 315 $error = $rows = null; 316 $has_room = false; 317 318 // generate table rows 319 if ( !empty( $rooms ) ) { 320 ob_start(); 321 foreach ( $rooms as $room_id => $room ) { 322 // Check if room is enabled 323 $enable = !empty($room['enable']) && boolval($room['enable']); 324 325 if ( $enable ) { 326 327 /* 328 * Backend room options 329 */ 330 $footage = !empty( $room['footage'] ) ? $room['footage'] : 0; 331 $bed = !empty( $room['bed'] ) ? $room['bed'] : 0; 332 $adult_number = !empty( $room['adult'] ) ? $room['adult'] : 0; 333 $child_number = !empty( $room['child'] ) ? $room['child'] : 0; 334 $pricing_by = !empty( $room['pricing-by'] ) ? $room['pricing-by'] : ''; 335 $room_price = !empty( $room['price'] ) ? $room['price'] : 0; 336 $room_adult_price = !empty( $room['adult_price'] ) ? $room['adult_price'] : 0; 337 $room_child_price = !empty( $room['child_price'] ) ? $room['child_price'] : 0; 338 $total_person = $adult_number + $child_number; 339 $price = $pricing_by == '1' ? $room_price : $room_adult_price + $room_child_price; 340 $form_check_in = $form_start; 341 $form_check_out = $form_end; 342 343 // Check availability by date option 344 $period = new DatePeriod( 345 new DateTime( $form_start . ' 00:00' ), 346 new DateInterval( 'P1D' ), 347 new DateTime( $form_end . ' 23:59' ) 348 ); 349 350 $days = iterator_count( $period ); 351 352 /** 353 * Set room availability 354 */ 355 $unique_id = !empty($room['unique_id']) ? $room['unique_id'] : ''; 356 $order_ids = !empty($room['order_id']) ? $room['order_id'] : ''; 357 $num_room_available = !empty($room['num-room']) ? $room['num-room'] : '1'; 358 $reduce_num_room = !empty($room['reduce_num_room']) ? $room['reduce_num_room'] : false; 359 $number_orders = '0'; 360 $avil_by_date = !empty( $room['avil_by_date'] ) ? $room['avil_by_date'] : false; // Room Available by date enabled or not ? 361 if($avil_by_date) { 362 $repeat_by_date = !empty( $room['repeat_by_date'] ) ? $room['repeat_by_date'] : []; 363 } 364 365 if( !empty( $order_ids ) && defined( 'TF_PRO' ) && $reduce_num_room == true ) { 366 367 # Get backend available date range as an array 368 if ( $avil_by_date ) { 369 370 $order_date_ranges = array(); 371 372 $backend_date_ranges = array(); 373 foreach($repeat_by_date as $single_date_range) { 374 375 array_push( $backend_date_ranges, array( strtotime( $single_date_range["availability"]["from"] ), strtotime( $single_date_range["availability"]["to"] ) ) ); 376 377 } 378 } 379 380 # Convert order ids to array 381 $order_ids = explode(',', $order_ids); 382 383 # Run foreach loop through oder ids 384 foreach( $order_ids as $order_id ) { 385 386 # Get $order object from order ID 387 $order = wc_get_order( $order_id ); 388 389 # Get Only the completed orders 390 if ( $order && $order->get_status() == 'completed' ) { 391 392 # Get and Loop Over Order Items 393 foreach ( $order->get_items() as $item_id => $item ) { 394 395 /** 396 * Order item data 397 */ 398 $ordered_number_of_room = $item->get_meta( 'number_room_booked', true ); 399 400 if ( $avil_by_date ) { 401 402 $order_check_in_date = strtotime( $item->get_meta( 'check_in', true ) ); 403 $order_check_out_date = strtotime( $item->get_meta( 'check_out', true ) ); 404 405 foreach($repeat_by_date as $single_date_range) { 406 407 if( strtotime( $single_date_range["availability"]["from"] ) <= strtotime( $form_start ) && strtotime( $single_date_range["availability"]["to"] ) >= strtotime( $form_end ) ) { 408 409 if( strtotime( $single_date_range["availability"]["from"] ) <= $order_check_in_date && strtotime( $single_date_range["availability"]["to"] ) >= $order_check_out_date ) { 410 411 $number_orders = $number_orders + $ordered_number_of_room; 412 413 } 414 415 } 416 417 } 418 419 array_push( $order_date_ranges, array( $order_check_in_date, $order_check_out_date ) ); 420 421 } else { 422 423 # Total number of room booked 424 $number_orders = $number_orders + $ordered_number_of_room; 425 426 } 427 428 } 429 } 430 } 431 432 # Calculate available room number after order 433 $num_room_available = $num_room_available - $number_orders; // Calculate 434 $num_room_available = max($num_room_available, 0); // If negetive value make that 0 435 436 } 437 438 if ( $avil_by_date && defined( 'TF_PRO' ) ) { 439 440 // split date range 441 $check_in = strtotime( $form_start . ' 00:00' ); 442 $check_out = strtotime( $form_end . ' 23:59' ); 443 $price = 0; 444 $has_room = []; 445 446 // extract price from available room options 447 foreach ( $period as $date ) { 448 449 $available_rooms = array_values( array_filter( $repeat_by_date, function ($date_availability ) use ( $date ) { 450 451 $date_availability_from = strtotime( $date_availability['availability']['from'] . ' 00:00' ); 452 $date_availability_to = strtotime( $date_availability['availability']['to'] . ' 23:59' ); 453 454 return strtotime( $date->format( 'd-M-Y' ) ) >= $date_availability_from && strtotime( $date->format( 'd-M-Y' ) ) <= $date_availability_to; 455 456 } ) ); 457 458 if ( is_iterable($available_rooms) && count( $available_rooms ) >=1) { 459 460 $room_price = !empty( $available_rooms[0]['price'] ) ? $available_rooms[0]['price'] : $room_price; 461 $adult_price = !empty( $available_rooms ) ? $available_rooms[0]['adult_price'] : $room_adult_price; 462 $child_price = !empty( $available_rooms ) ? $available_rooms[0]['child_price'] : $room['child_price']; 463 $price_by_date = $pricing_by == '1' ? $room_price : ( ( $adult_price * $form_adult ) + ( $child_price * $form_child ) ); 464 $price += $price_by_date; 465 $number_of_rooms = !empty($available_rooms[0]['num-room']) ? $available_rooms[0]['num-room'] : $room['num-room']; 466 $has_room[] = 1; 467 468 } else $has_room[] = 0; 469 470 } 471 472 // Check if date is provided and within date range 473 if ( !in_array( 0, $has_room ) ) { 474 475 if ( $form_total_person <= $total_person ) { 476 477 include TF_TEMPLATE_PART_PATH . 'hotel\hotel-availability-table-row.php'; 478 479 } else { 480 481 $error = __( 'No Room Available! Total person number exceeds!', 'tourfic' ); 482 } 483 484 } else { 485 486 $error = __( 'No Room Available within this Date Range!', 'tourfic' ); 487 488 } 489 490 } else { 491 492 if ($pricing_by == '1') { 493 $price_by_date = $room_price; 494 } else { 495 $price_by_date = (($room_adult_price * $form_adult) + ($room_child_price * $form_child)); 496 } 497 498 $price = $room['price_multi_day'] == '1' ? $price_by_date * $days : $price_by_date; 499 500 if ( $form_total_person <= $total_person ) { 501 502 include TF_TEMPLATE_PART_PATH . 'hotel\hotel-availability-table-row.php'; 503 504 } else { 505 506 $error = __( 'No Room Available! Total person number exceeds!', 'tourfic' ); 507 508 } 509 510 } 511 512 } else { 513 514 $error = __( 'No Room Available!', 'tourfic' ); 515 330 516 } 331 $b_check_out = !empty($room['availability']['to']) ? $room['availability']['to'] : '';332 if($b_check_out) {333 $b_check_out_stt = strtotime($b_check_out);334 }335 336 // Check if date is provided and within date range337 if(empty($b_check_in) || empty($b_check_out) || ($form_check_in_stt >= $b_check_in_stt && $form_check_out_stt <= $b_check_out_stt)) {338 339 if ($form_total_person <= $total_person) {340 ?>341 <tr>342 <td class="description">343 <div class="tf-room-type">344 <div class="tf-room-title"><?php echo esc_html( $room['title'] ); ?></div>345 <div class="bed-facilities"><?php echo $room['description']; ?></div>346 </div>347 348 <div class="tf-room-title">349 <?php esc_html_e( 'Key Features', 'tourfic' ); ?>350 </div>351 352 <?php if ($footage) { ?>353 <div class="tf-tooltip tf-d-ib">354 <div class="room-detail-icon">355 <span class="room-icon-wrap"><i class="fas fa-ruler-combined"></i></span>356 <span class="icon-text tf-d-b"><?php echo $footage; ?> sft</span>357 </div>358 <div class="tf-top">359 <?php _e( 'Room Footage', 'tourfic' ); ?>360 <i class="tool-i"></i>361 </div>362 </div>363 <?php }364 if ($bed) { ?>365 <div class="tf-tooltip tf-d-ib">366 <div class="room-detail-icon">367 <span class="room-icon-wrap"><i class="fas fa-bed"></i></span>368 <span class="icon-text tf-d-b">x<?php echo $bed; ?></span>369 </div>370 <div class="tf-top">371 <?php _e( 'No. Beds', 'tourfic' ); ?>372 <i class="tool-i"></i>373 </div>374 </div>375 <?php } ?>376 377 <div class="room-features">378 <div class="tf-room-title"><?php esc_html_e( 'Amenities', 'tourfic' ); ?></div>379 <ul class="room-feature-list">380 381 <?php foreach ($room['features'] as $feature) {382 383 $room_f_meta = get_term_meta( $feature, 'hotel_feature', true );384 385 if ($room_f_meta['icon-type'] == 'fa') {386 $room_feature_icon = '<i class="' .$room_f_meta['icon-fa']. '"></i>';387 } elseif ($room_f_meta['icon-type'] == 'c') {388 $room_feature_icon = '<img src="' .$room_f_meta['icon-c']["url"]. '" style="min-width: ' .$room_f_meta['dimention']["width"]. 'px; height: ' .$room_f_meta['dimention']["width"]. 'px;" />';389 }390 391 $room_term = get_term( $feature ); ?>392 <li class="tf-tooltip">393 <?php echo $room_feature_icon; ?>394 <div class="tf-top">395 <?php echo $room_term->name; ?>396 <i class="tool-i"></i>397 </div>398 </li>399 <?php } ?>400 </ul>401 </div>402 </td>403 <td class="pax">404 405 <?php if ($adult_number) { ?>406 <div class="tf-tooltip tf-d-b">407 <div class="room-detail-icon">408 <span class="room-icon-wrap"><i class="fas fa-male"></i><i class="fas fa-female"></i></span>409 <span class="icon-text tf-d-b">x<?php echo $adult_number; ?></span>410 </div>411 <div class="tf-top">412 <?php _e( 'No. Adults', 'tourfic' ); ?>413 <i class="tool-i"></i>414 </div>415 </div>416 <?php }417 if ($child_number) { ?>418 <div class="tf-tooltip tf-d-b">419 <div class="room-detail-icon">420 <span class="room-icon-wrap"><i class="fas fa-baby"></i></span>421 <span class="icon-text tf-d-b">x<?php echo $child_number; ?></span>422 </div>423 <div class="tf-top">424 <?php _e( 'No. Children', 'tourfic' ); ?>425 <i class="tool-i"></i>426 </div>427 </div>428 <?php } ?>429 </td>430 <td class="pricing">431 <div class="tf-price-column">432 <?php if ($pricing_by == '1') { ?>433 <span class="tf-price"><?php echo wc_price( $room['price'] ); ?></span>434 <div class="price-per-night"><?php esc_html_e( 'per night', 'tourfic' ); ?></div>435 <?php } elseif ($pricing_by == '2') { ?>436 <span class="tf-price"><?php echo wc_price( $room['adult_price'] ); ?></span>437 <div class="price-per-night"><?php esc_html_e( 'per person/night', 'tourfic' ); ?></div>438 <?php } ?>439 </div>440 </td>441 <td class="reserve">442 <form class="tf-room">443 <?php wp_nonce_field( 'check_room_booking_nonce', 'tf_room_booking_nonce' ); ?>444 <div class="room-selection-wrap">445 <select name="hotel_room_selected" id="hotel-room-selected">446 <?php447 foreach (range(1,8) as $value) {448 echo '<option>' . $value . '</option>';449 }450 ?>451 </select>452 </div>453 <div class="room-submit-wrap">454 <input type="hidden" name="post_id" value="<?php echo $form_post_id; ?>">455 <input type="hidden" name="room_id" value="<?php echo $room_id; ?>">456 <input type="hidden" name="location" value="<?php echo $first_location_name; ?>">457 <input type="hidden" name="adult" value="<?php echo $form_adult; ?>">458 <input type="hidden" name="child" value="<?php echo $form_child; ?>">459 <input type="hidden" name="check_in_date" value="<?php echo $form_check_in; ?>">460 <input type="hidden" name="check_out_date" value="<?php echo $form_check_out; ?>">461 <button class="hotel-room-book" type="submit"><?php _e('I\'ll reserve', 'tourfic'); ?></button>462 </div>463 <div class="tf_desc"></div>464 </form>465 </td>466 </tr>467 <?php468 } else {469 echo '<tr><td colspan="4" style="text-align:center;font-weight:bold;">' .__("No Room Available! Total person number exceeds!", "tourfic"). '</td></tr>';470 }471 } else {472 echo '<tr><td colspan="4" style="text-align:center;font-weight:bold;">' .__("No Room Available within this Date Range!", "tourfic"). '</td></tr>';473 }474 } else {475 echo '<tr><td colspan="4" style="text-align:center;font-weight:bold;">' .__("No Room Available!", "tourfic"). '</td></tr>';476 517 } 477 } 518 519 $rows .= ob_get_clean(); 520 521 } else { 522 523 $error = __( 'No Room Available!', 'tourfic' ); 524 525 } 526 527 if ( !empty( $rows ) ) { 528 529 echo $rows . '</tbody> </table> </div>'; 530 478 531 } else { 479 echo '<tr><td colspan="4" style="text-align:center;font-weight:bold;">' .__("No Room Available!", "tourfic"). '</td></tr>'; 532 533 echo sprintf( "<tr><td colspan=\"4\" style=\"text-align:center;font-weight:bold;\">%s</td></tr>", __( $error, "tourfic" ) ).'</tbody> </table> </div>'; 534 480 535 } 481 ?> 482 </tbody> 483 </table> 484 </div> 485 486 <?php 536 487 537 wp_die(); 488 538 } … … 546 596 <div class="tf_input-inner"> 547 597 <span class="tf_person-icon"> 548 < ?php echo tourfic_get_svg('person'); ?>598 <i class="fas fa-user"></i> 549 599 </span> 550 600 <div class="adults-text"><?php echo (!empty($adults) ? $adults : '1') . ' ' . __('Adults', 'tourfic'); ?></div> … … 593 643 <div class="tf_form-inner tf-d-g"> 594 644 <i class="far fa-calendar-alt"></i> 595 <input type="text" name="check-in-out-date" id="check-in-out-date" onkeypress="return false;" placeholder="<?php _e('Check-in - Check-out', 'tourfic'); ?>" >645 <input type="text" name="check-in-out-date" id="check-in-out-date" onkeypress="return false;" placeholder="<?php _e('Check-in - Check-out', 'tourfic'); ?>" <?php echo tfopt('date_hotel_search')? 'required' : ''; ?>> 596 646 </div> 597 647 </label> … … 749 799 //Get hotel_feature 750 800 $features = !empty(get_the_terms( $post_id, 'hotel_feature' )) ? get_the_terms( $post_id, 'hotel_feature' ) : ''; 751 //Get hotel meta values 752 $meta = get_post_meta( get_the_ID(), 'tf_hotel', true ); 801 753 802 // Location 754 803 $address = !empty($meta['address']) ? $meta['address'] : ''; … … 904 953 } 905 954 955 /** 956 * Filter hotels on search result page by checkin checkout dates set by backend 957 * 958 * 959 * @author devkabir, fida 960 * 961 * @param DatePeriod $period collection of dates by user input; 962 * @param array $not_found collection of hotels exists 963 * @param array $data user input for sidebar form 964 */ 965 function tf_filter_hotel_by_date( $period, array &$not_found, array $data = [] ): void { 966 967 // Form Data 968 [$adults, $child, $room, $check_in_out] = $data; 969 970 // Get hotel meta options 971 $meta = get_post_meta(get_the_ID(), 'tf_hotel', true); 972 // Remove disabled rooms 973 $meta = array_filter($meta['room'], function ($value) { 974 return !empty($value) && $value['enable'] != '0'; 975 }); 976 977 // If no room return 978 if (empty($meta)) { 979 return; 980 } 981 982 // Set initial room availability status 983 $has_hotel = false; 984 985 /** 986 * Adult Number Validation 987 */ 988 $back_adults = array_column($meta, 'adult'); 989 $adult_counter = 0; 990 foreach($back_adults as $back_adult) { 991 if($back_adult >= $adults) { 992 $adult_counter++; 993 } 994 } 995 996 /** 997 * Child Number Validation 998 */ 999 $back_childs = array_column($meta, 'adult'); 1000 $child_counter = 0; 1001 foreach($back_childs as $back_child) { 1002 if($back_child >= $child) { 1003 $child_counter++; 1004 } 1005 } 1006 1007 // If adult and child number validation is true proceed 1008 if($adult_counter > 0 && $child_counter > 0) { 1009 1010 // Check custom date range status of room 1011 $avil_by_date = array_column($meta, 'avil_by_date'); 1012 1013 // Check if any room available without custom date range 1014 if ( in_array( 0, $avil_by_date ) || empty( $avil_by_date ) ) { 1015 1016 $has_hotel = true; // Show that hotel 1017 1018 } else { 1019 // If all the room has custom date range then filter the rooms by date 1020 1021 // Get custom date range repeater 1022 $dates = array_column($meta, 'repeat_by_date'); 1023 1024 // If no date range return 1025 if (empty($dates)) { 1026 return; 1027 } 1028 1029 // Initial available dates array 1030 $availability_dates = []; 1031 1032 // Run loop through custom date range repeater and filter out only the dates 1033 foreach ($dates as $date) { 1034 $availability_dates[] = array_column($date, 'availability'); 1035 } 1036 1037 // Run loop through custom dates & set custom dates on a single array 1038 foreach (tf_array_flatten($availability_dates, 1) as $dates) { 1039 1040 //Initial matching date array 1041 $show_hotel = []; 1042 1043 // Check if any date range match with search form date range and set them on array 1044 if(!empty($period)) { 1045 foreach ( $period as $date ) { 1046 1047 $show_hotel[] = intval( strtotime( $date->format( 'Y-m-d' ) ) >= strtotime( $dates['from'] ) && strtotime( $date->format( 'Y-m-d' ) ) <= strtotime( $dates['to'] ) ); 1048 1049 } 1050 } 1051 1052 // If any date range matches show hotel 1053 if ( !in_array( 0, $show_hotel ) ) { 1054 $has_hotel = true; 1055 break; 1056 } 1057 1058 } 1059 1060 } 1061 1062 } 1063 1064 // Conditional hotel showing 1065 if ( $has_hotel ) { 1066 1067 if ( !empty( $data ) ) { 1068 [$adults, $child, $room, $check_in_out] = $data; 1069 tf_hotel_archive_single_item( $adults, $child, $room, $check_in_out ); 1070 } else { 1071 tf_hotel_archive_single_item(); 1072 } 1073 1074 $not_found[] = 0; 1075 1076 } else { 1077 1078 $not_found[] = 1; 1079 1080 } 1081 1082 } 1083 1084 /** 1085 * Remove room order ids 1086 */ 1087 function tf_remove_order_ids_from_room() { 1088 echo ' 1089 <div class="csf-title"> 1090 <h4>' .__("Reset Room Availability", "tourfic"). '</h4> 1091 <div class="csf-subtitle-text">' .__("Remove order ids linked with this room.<br><b style='color: red;'>Be aware! It is irreversible!</b>", "tourfic"). '</div> 1092 </div> 1093 <div class="csf-fieldset"> 1094 <button type="button" class="button button-large csf-warning-primary remove-order-ids">' .__("Reset", "tourfic"). '</button> 1095 </div> 1096 <div class="clear"></div> 1097 '; 1098 } 1099 1100 /** 1101 * Ajax remove room order ids 1102 */ 1103 add_action( 'wp_ajax_tf_remove_room_order_ids', 'tf_remove_room_order_ids' ); 1104 function tf_remove_room_order_ids() { 1105 1106 # Get order id field's name 1107 $meta_field = isset( $_POST['meta_field'] ) ? sanitize_text_field( $_POST['meta_field'] ) : ''; 1108 # Trim room id from order id name 1109 $room_id = trim($meta_field, "tf_hotel[room][][order_id"); 1110 # Get post id 1111 $post_id = isset( $_POST['post_id'] ) ? sanitize_text_field( $_POST['post_id'] ) : ''; 1112 # Get hotel meta 1113 $meta = get_post_meta( $post_id, 'tf_hotel', true ); 1114 1115 # Set order id field's value to blank 1116 $meta['room'][$room_id]['order_id'] = ''; 1117 1118 # Update whole hotel meta 1119 update_post_meta( $post_id, 'tf_hotel', $meta ); 1120 1121 # Send success message 1122 wp_send_json_success( __( 'Order ids have been removed!', 'tourfic' ) ); 1123 1124 wp_die(); 1125 } 1126 906 1127 ################################# 907 1128 # WooCommerce integration # … … 917 1138 tf_file_missing(TF_INC_PATH . 'functions/woocommerce/wc-hotel.php'); 918 1139 } 1140 1141 ################################# 1142 # Temporary # 1143 ################################# 1144 /** 1145 * Add missing unique id to hotel room 1146 */ 1147 function tf_update_missing_room_id() { 1148 1149 if ( get_option( 'tf_miss_room_id' ) < 1 ) { 1150 1151 $args = array( 1152 'posts_per_page' => -1, 1153 'post_type' => 'tf_hotel', 1154 'suppress_filters' => true 1155 ); 1156 $posts_array = get_posts( $args ); 1157 foreach($posts_array as $post_array) { 1158 $meta = get_post_meta( $post_array->ID, 'tf_hotel', true ); 1159 $rooms = !empty($meta['room']) ? $meta['room'] : ''; 1160 $new_rooms = []; 1161 foreach($rooms as $room) { 1162 1163 if(empty($room['unique_id'])) { 1164 $room['unique_id'] = mt_rand(1, time()); 1165 } 1166 $new_rooms[] = $room; 1167 } 1168 $meta['room'] = $new_rooms; 1169 update_post_meta($post_array->ID, 'tf_hotel', $meta ); 1170 1171 } 1172 update_option( 'tf_miss_room_id', 1 ); 1173 } 1174 } 1175 add_action( 'init', 'tf_update_missing_room_id' ); 1176 1177 /** 1178 * Run Once 1179 * Add _price post_meta to all hotels & tours 1180 * 1181 * Will be delete in future version 1182 */ 1183 function tf_update_meta_all_hotels_tours() { 1184 1185 // Run once only 1186 if ( get_option( 'tf_update_hotel_price' ) < 1 ) { 1187 1188 // Update hotels meta 1189 $args = array( 1190 'posts_per_page' => -1, 1191 'post_type' => 'tf_hotel', 1192 'suppress_filters' => true 1193 ); 1194 $posts_array = get_posts( $args ); 1195 foreach( $posts_array as $post_array ) { 1196 update_post_meta( $post_array->ID, '_price', '0' ); 1197 } 1198 1199 // Update tours meta 1200 $args = array( 1201 'posts_per_page' => -1, 1202 'post_type' => 'tf_tours', 1203 'suppress_filters' => true 1204 ); 1205 $posts_array = get_posts( $args ); 1206 foreach( $posts_array as $post_array ) { 1207 update_post_meta( $post_array->ID, '_price', '0' ); 1208 } 1209 1210 update_option( 'tf_update_hotel_price', 1 ); 1211 1212 } 1213 } 1214 add_action( 'wp_loaded', 'tf_update_meta_all_hotels_tours' ); 919 1215 ?> -
tourfic/trunk/inc/functions/functions-tour.php
r2715826 r2742744 57 57 'has_archive' => true, 58 58 'hierarchical' => false, 59 'menu_position' => 2 5,59 'menu_position' => 26.3, 60 60 'supports' => apply_filters( 'tf_tours_supports', array( 'title', 'editor', 'thumbnail', 'comments', 'author' ) ), 61 61 ); … … 223 223 */ 224 224 if ( !function_exists('tf_tour_search_form_horizontal') ) { 225 function tf_tour_search_form_horizontal( $classes, $title, $subtitle ){ 225 function tf_tour_search_form_horizontal( $classes, $title, $subtitle ) { 226 226 227 ?> 227 228 <form class="tf_booking-widget <?php esc_attr_e( $classes ); ?>" method="get" autocomplete="off" action="<?php echo tf_booking_search_action(); ?>"> 228 229 229 <?php if( $title ) :?>230 <?php if( $title ) { ?> 230 231 <div class="tf_widget-title"><h2><?php esc_html_e( $title ); ?></h2></div> 231 <?php endif;?>232 233 <?php if( $subtitle ) :?>232 <?php } ?> 233 234 <?php if( $subtitle ) { ?> 234 235 <div class="tf_widget-subtitle"><?php esc_html_e( $subtitle ); ?></div> 235 <?php endif; ?> 236 <div class="tf_homepage-booking"> 237 <div class="tf_destination-wrap"> 238 <div class="tf_input-inner"> 239 <div class="tf_form-row"> 240 <label class="tf_label-row"> 241 <span class="tf-label"><?php _e('Destination', 'tourfic'); ?>:</span> 242 <div class="tf_form-inner tf-d-g"> 243 <i class="fas fa-search"></i> 244 <input type="text" required id="tf-destination" class="" placeholder="<?php _e('Enter Destination', 'tourfic'); ?>" value=""> 245 <input type="hidden" name="place" class="tf-place-input" /> </div> 246 </label> 247 </div> 248 </div> 249 </div> 250 251 <div class="tf_selectperson-wrap"> 252 <div class="tf_input-inner"> 253 <span class="tf_person-icon"> 254 <?php echo tourfic_get_svg('person'); ?> 255 </span> 256 <div class="adults-text">1 <?php _e('Adults', 'tourfic'); ?></div> 257 <div class="person-sep"></div> 258 <div class="child-text">0 <?php _e('Children', 'tourfic'); ?></div> 259 <div class="person-sep"></div> 260 <div class="infant-text">0 <?php _e('Infant', 'tourfic'); ?></div> 261 </div> 262 <div class="tf_acrselection-wrap"> 263 <div class="tf_acrselection-inner"> 264 <div class="tf_acrselection"> 265 <div class="acr-label"><?php _e('Adults', 'tourfic'); ?></div> 266 <div class="acr-select"> 267 <div class="acr-dec">-</div> 268 <input type="number" name="adults" id="adults" min="1" value="1"> 269 <div class="acr-inc">+</div> 270 </div> 271 </div> 272 <div class="tf_acrselection"> 273 <div class="acr-label"><?php _e('Children', 'tourfic'); ?></div> 274 <div class="acr-select"> 275 <div class="acr-dec">-</div> 276 <input type="number" name="children" id="children" min="0" value="0"> 277 <div class="acr-inc">+</div> 278 </div> 279 </div> 280 <div class="tf_acrselection"> 281 <div class="acr-label"><?php _e('Infant', 'tourfic'); ?></div> 282 <div class="acr-select"> 283 <div class="acr-dec">-</div> 284 <input type="number" name="infant" id="infant" min="0" value="0"> 285 <div class="acr-inc">+</div> 236 <?php } ?> 237 238 <div class="tf_homepage-booking"> 239 <div class="tf_destination-wrap"> 240 <div class="tf_input-inner"> 241 <div class="tf_form-row"> 242 <label class="tf_label-row"> 243 <span class="tf-label"><?php _e('Destination', 'tourfic'); ?>:</span> 244 <div class="tf_form-inner tf-d-g"> 245 <i class="fas fa-search"></i> 246 <input type="text" required id="tf-destination" class="" placeholder="<?php _e('Enter Destination', 'tourfic'); ?>" value=""> 247 <input type="hidden" name="place" class="tf-place-input" /> </div> 248 </label> 286 249 </div> 287 250 </div> 288 251 </div> 252 253 <div class="tf_selectperson-wrap"> 254 <div class="tf_input-inner"> 255 <span class="tf_person-icon"> 256 <i class="fas fa-user"></i> 257 </span> 258 <div class="adults-text">1 <?php _e('Adults', 'tourfic'); ?></div> 259 <div class="person-sep"></div> 260 <div class="child-text">0 <?php _e('Children', 'tourfic'); ?></div> 261 <div class="person-sep"></div> 262 <div class="infant-text">0 <?php _e('Infant', 'tourfic'); ?></div> 263 </div> 264 <div class="tf_acrselection-wrap"> 265 <div class="tf_acrselection-inner"> 266 <div class="tf_acrselection"> 267 <div class="acr-label"><?php _e('Adults', 'tourfic'); ?></div> 268 <div class="acr-select"> 269 <div class="acr-dec">-</div> 270 <input type="number" name="adults" id="adults" min="1" value="1"> 271 <div class="acr-inc">+</div> 272 </div> 273 </div> 274 <div class="tf_acrselection"> 275 <div class="acr-label"><?php _e('Children', 'tourfic'); ?></div> 276 <div class="acr-select"> 277 <div class="acr-dec">-</div> 278 <input type="number" name="children" id="children" min="0" value="0"> 279 <div class="acr-inc">+</div> 280 </div> 281 </div> 282 <div class="tf_acrselection"> 283 <div class="acr-label"><?php _e('Infant', 'tourfic'); ?></div> 284 <div class="acr-select"> 285 <div class="acr-dec">-</div> 286 <input type="number" name="infant" id="infant" min="0" value="0"> 287 <div class="acr-inc">+</div> 288 </div> 289 </div> 290 </div> 291 </div> 292 </div> 293 294 <div class="tf_selectdate-wrap"> 295 <!-- @KK Merged two inputs into one --> 296 <div class="tf_input-inner"> 297 <label class="tf_label-row"> 298 <span class="tf-label"><?php _e('Check-in & Check-out date', 'tourfic'); ?></span> 299 <div class="tf_form-inner tf-d-g"> 300 <i class="far fa-calendar-alt"></i> 301 <input type="text" name="check-in-out-date" id="check-in-out-date" onkeypress="return false;" placeholder="<?php _e('Select Date', 'tourfic'); ?>" <?php echo tfopt('date_tour_search')? 'required' : ''; ?>> 302 </div> 303 </label> 304 </div> 305 </div> 306 307 <div class="tf_submit-wrap"> 308 <input type="hidden" name="type" value="tf_tours" class="tf-post-type"/> 309 <button class="tf_button tf-submit tf-tours-btn" type="submit"><?php esc_html_e( 'Search', 'tourfic' ); ?></button> 310 </div> 311 289 312 </div> 290 </div> 291 292 <div class="tf_selectdate-wrap"> 293 <!-- @KK Merged two inputs into one --> 294 <div class="tf_input-inner"> 295 <label class="tf_label-row"> 296 <span class="tf-label"><?php _e('Check-in & Check-out date', 'tourfic'); ?></span> 297 <div class="tf_form-inner tf-d-g"> 298 <i class="far fa-calendar-alt"></i> 299 <input type="text" name="check-in-out-date" id="check-in-out-date" onkeypress="return false;" placeholder="<?php _e('Select Date', 'tourfic'); ?>" required> 300 </div> 301 </label> 302 </div> 303 </div> 304 305 <div class="tf_submit-wrap"> 306 <input type="hidden" name="type" value="tf_tours" class="tf-post-type"/> 307 <button class="tf_button tf-submit tf-tours-btn" type="submit"><?php esc_html_e( 'Search', 'tourfic' ); ?></button> 308 </div> 309 310 </div> 311 312 </form> 313 314 </form> 313 315 <script> 314 316 (function($) { … … 338 340 // Value from URL 339 341 // Adults 340 $adults = !empty( $_GET['adults']) ? sanitize_text_field($_GET['adults']) : '';342 $adults = !empty( $_GET['adults'] ) ? sanitize_text_field( $_GET['adults'] ) : ''; 341 343 // children 342 $child = !empty( $_GET['children']) ? sanitize_text_field($_GET['children']) : '';344 $child = !empty( $_GET['children'] ) ? sanitize_text_field( $_GET['children'] ) : ''; 343 345 // room 344 $infant = !empty( $_GET['infant']) ? sanitize_text_field($_GET['infant']) : '';346 $infant = !empty( $_GET['infant'] ) ? sanitize_text_field( $_GET['infant'] ) : ''; 345 347 // Check-in & out date 346 $check_in_out = !empty( $_GET['check-in-out-date']) ? sanitize_text_field($_GET['check-in-out-date']) : '';348 $check_in_out = !empty( $_GET['check-in-out-date'] ) ? sanitize_text_field( $_GET['check-in-out-date'] ) : ''; 347 349 348 350 $meta = get_post_meta( $post_id, 'tf_tours_option', true ); 349 $tour_type = !empty( $meta['type']) ? $meta['type'] : '';351 $tour_type = !empty( $meta['type'] ) ? $meta['type'] : ''; 350 352 // Continuous custom availability 351 $custom_avail = !empty( $meta['custom_avail']) ? $meta['custom_avail'] : '';352 353 if ( $tour_type == 'fixed') {354 355 $departure_date = !empty( $meta['fixed_availability']['date']['from']) ? $meta['fixed_availability']['date']['from'] : '';356 $return_date = !empty( $meta['fixed_availability']['date']['to']) ? $meta['fixed_availability']['date']['to'] : '';357 $min_people = !empty( $meta['fixed_availability']['min_seat']) ? $meta['fixed_availability']['min_seat'] : '';358 $max_people = !empty( $meta['fixed_availability']['max_seat']) ? $meta['fixed_availability']['max_seat'] : '';359 360 } elseif ( $tour_type == 'continuous') {361 362 $disabled_day = !empty( $meta['disabled_day']) ? $meta['disabled_day'] : '';363 $disable_range = !empty( $meta['disable_range']) ? $meta['disable_range'] : '';364 $disable_specific = !empty( $meta['disable_specific']) ? $meta['disable_specific'] : '';365 $disable_specific = str_replace( ', ', '", "', $disable_specific);366 367 if ( $custom_avail == true) {368 369 $cont_custom_date = !empty( $meta['cont_custom_date']) ? $meta['cont_custom_date'] : '';353 $custom_avail = !empty( $meta['custom_avail'] ) ? $meta['custom_avail'] : ''; 354 355 if ( $tour_type == 'fixed' ) { 356 357 $departure_date = !empty( $meta['fixed_availability']['date']['from'] ) ? $meta['fixed_availability']['date']['from'] : ''; 358 $return_date = !empty( $meta['fixed_availability']['date']['to'] ) ? $meta['fixed_availability']['date']['to'] : ''; 359 $min_people = !empty( $meta['fixed_availability']['min_seat'] ) ? $meta['fixed_availability']['min_seat'] : ''; 360 $max_people = !empty( $meta['fixed_availability']['max_seat'] ) ? $meta['fixed_availability']['max_seat'] : ''; 361 362 } elseif ( $tour_type == 'continuous' ) { 363 364 $disabled_day = !empty( $meta['disabled_day'] ) ? $meta['disabled_day'] : ''; 365 $disable_range = !empty( $meta['disable_range'] ) ? $meta['disable_range'] : ''; 366 $disable_specific = !empty( $meta['disable_specific'] ) ? $meta['disable_specific'] : ''; 367 $disable_specific = str_replace( ', ', '", "', $disable_specific ); 368 369 if ( $custom_avail == true ) { 370 371 $cont_custom_date = !empty( $meta['cont_custom_date'] ) ? $meta['cont_custom_date'] : ''; 370 372 371 373 } … … 373 375 } 374 376 375 $disable_adult_price = !empty( $meta['disable_adult_price']) ? $meta['disable_adult_price'] : false;376 $disable_child_price = !empty( $meta['disable_child_price']) ? $meta['disable_child_price'] : false;377 $disable_infant_price = !empty( $meta['disable_infant_price']) ? $meta['disable_infant_price'] : false;378 $pricing_rule = !empty( $meta['pricing']) ? $meta['pricing'] : '';379 $group_price = !empty( $meta['group_price']) ? $meta['group_price'] : false;380 $adult_price = !empty( $meta['adult_price']) ? $meta['adult_price'] : false;381 $child_price = !empty( $meta['child_price']) ? $meta['child_price'] : false;382 $infant_price = !empty( $meta['infant_price']) ? $meta['infant_price'] : false;383 384 385 $tour_extras = isset( $meta['tour-extra']) ? $meta['tour-extra'] : null;377 $disable_adult_price = !empty( $meta['disable_adult_price'] ) ? $meta['disable_adult_price'] : false; 378 $disable_child_price = !empty( $meta['disable_child_price'] ) ? $meta['disable_child_price'] : false; 379 $disable_infant_price = !empty( $meta['disable_infant_price'] ) ? $meta['disable_infant_price'] : false; 380 $pricing_rule = !empty( $meta['pricing'] ) ? $meta['pricing'] : ''; 381 $group_price = !empty( $meta['group_price'] ) ? $meta['group_price'] : false; 382 $adult_price = !empty( $meta['adult_price'] ) ? $meta['adult_price'] : false; 383 $child_price = !empty( $meta['child_price'] ) ? $meta['child_price'] : false; 384 $infant_price = !empty( $meta['infant_price'] ) ? $meta['infant_price'] : false; 385 386 387 $tour_extras = isset( $meta['tour-extra'] ) ? $meta['tour-extra'] : null; 386 388 387 389 $times = []; 388 390 389 if ( $custom_avail == true && !empty($meta['cont_custom_date'])) {391 if ( $custom_avail == true && !empty( $meta['cont_custom_date'] ) ) { 390 392 $allowed_times = array_map(function ($v) { 391 393 return $times[] = ['date' => $v['date'], 'times' => array_map(function ($v) { … … 395 397 } 396 398 397 if ( $custom_avail == false && !empty($meta['allowed_time'])) {399 if ( $custom_avail == false && !empty( $meta['allowed_time'] ) ) { 398 400 $allowed_times = array_map(function ($v) { 399 401 return $v['time']; … … 408 410 <div class="tf_input-inner"> 409 411 <span class="tf_person-icon"> 410 < svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M16.5 6a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0zM18 6A6 6 0 1 0 6 6a6 6 0 0 0 12 0zM3 23.25a9 9 0 1 1 18 0 .75.75 0 0 0 1.5 0c0-5.799-4.701-10.5-10.5-10.5S1.5 17.451 1.5 23.25a.75.75 0 0 0 1.5 0z"></path></svg>412 <i class="fas fa-user"></i> 411 413 </span> 412 414 <?php if ($custom_avail == true || (!$disable_adult_price && $pricing_rule == 'person' && $adult_price != false) || (!$disable_adult_price && $pricing_rule == 'group' && $group_price != false)) { ?> … … 461 463 <label class='tf_label-row'> 462 464 <div class='tf_form-inner'> 463 <span class='icon'> 464 <?php tourfic_get_svg('calendar_today'); ?> 465 </span> 466 <input type='text' name='check-in-out-date' id='check-in-out-date' class='tours-check-in-out' onkeypress="return false;" placeholder='Select Date' value='' required /> 465 <input type='text' name='check-in-out-date' id='check-in-out-date' class='tours-check-in-out' onkeypress="return false;" placeholder='<?php _e( "Select Date", "tourfic" ); ?>' value='' required /> 467 466 </div> 468 467 </label> 469 468 </div> 470 469 470 <?php if ($tour_type != 'fixed') { ?> 471 471 <div class='tf_form-row' id="check-in-time-div" style="display: none;"> 472 472 <label class='tf_label-row'> 473 473 <div class='tf_form-inner'> 474 <span class='icon'>475 <?php tourfic_get_svg('calendar_today'); ?>476 </span>477 474 <select name="check-in-time" id="check-in-time" style="min-width: 100px;"> 478 475 </select> … … 480 477 </label> 481 478 </div> 479 <?php } ?> 482 480 483 481 <input type="hidden" name="post_id" value="<?php echo $post_id; ?>"> … … 497 495 timeSelect.empty(); 498 496 if (times.length > 0) { 499 timeSelect.append(`<option value="" selected hidden> Select time</option>`);497 timeSelect.append(`<option value="" selected hidden><?php _e( "Select Time", "tourfic" ); ?></option>`); 500 498 $.each(times, function(i, v) { 501 499 timeSelect.append(`<option value="${v}">${v}</option>`); … … 593 591 </script> 594 592 595 <?php if ( defined( 'TF_PRO' ) && $tour_extras) { ?>593 <?php if ( defined( 'TF_PRO' ) && $tour_extras ) { ?> 596 594 <div class="tour-extra"> 597 595 <a data-fancybox data-src="#tour-extra" href="javascript:;"><i class="far fa-plus-square"></i></a> … … 615 613 <?php } ?> 616 614 <div class="tf-tours-booking-btn"> 617 <input type="hidden" placeholder="location"name="location" value="">615 <input type="hidden" name="location" value=""> 618 616 <button class="tf_button" type="submit"><?php _e('Book Now', 'tourfic'); ?></button> 619 617 </div> … … 635 633 // get post id 636 634 $post_id = get_the_ID(); 637 //Get hotel meta values 638 $meta = get_post_meta( get_the_ID(),'tf_tours_option',true ); 635 639 636 // Location 640 637 $location = !empty($meta['text_location']) ? $meta['text_location'] : ''; … … 719 716 tf_file_missing(TF_INC_PATH . 'functions/woocommerce/wc-tour.php'); 720 717 } 718 719 /** 720 * Filter tours on search result page by checkin checkout dates set by backend 721 * 722 * 723 * @author devkabir, fida 724 * 725 * @param DatePeriod $period collection of dates by user input; 726 * @param array $not_found collection of tour exists 727 * @param array $data user input for sidebar form 728 */ 729 function tf_filter_tour_by_date( $period, array &$not_found, array $data = [] ): void { 730 731 // Get tour meta options 732 $meta = get_post_meta( get_the_ID(), 'tf_tours_option', true ); 733 734 // Set initial tour availability status 735 $has_tour = false; 736 737 if ( $meta['type'] === 'fixed' ) { 738 739 $fixed_availability = !empty( $meta['fixed_availability'] ) ? $meta['fixed_availability']['date'] : []; 740 $show_fixed_tour = []; 741 742 foreach ( $period as $date ) { 743 744 $show_fixed_tour[] = intval( strtotime( $date->format( 'Y-m-d' ) ) >= strtotime( $fixed_availability['from'] ) && strtotime( $date->format( 'Y-m-d' ) ) <= strtotime( $fixed_availability['to'] ) ); 745 746 } 747 748 $has_tour = !in_array( 0, $show_fixed_tour ); 749 750 } 751 752 if ( $meta['type'] === 'continuous' ) { 753 754 $custom_availability = !empty($meta['custom_avail']) ? $meta['custom_avail'] : false; 755 756 if ($custom_availability) { 757 758 $custom_dates = wp_list_pluck( $meta['cont_custom_date'], 'date' ); 759 760 foreach ( $custom_dates as $custom_date ) { 761 762 $show_continuous_tour = []; 763 764 foreach ( $period as $date ) { 765 766 $show_continuous_tour[] = intval( strtotime( $date->format( 'Y-m-d' ) ) >= strtotime( $custom_date['from'] ) && strtotime( $date->format( 'Y-m-d' ) ) <= strtotime( $custom_date['to'] ) ); 767 768 } 769 770 if ( !in_array( 0, $show_continuous_tour ) ) { 771 772 $has_tour = true; 773 break; 774 775 } 776 777 } 778 779 } else { 780 781 $has_tour = true; 782 783 } 784 785 } 786 787 if ( $has_tour ) { 788 789 if ( !empty( $data ) ) { 790 791 [$adults, $child, $check_in_out] = $data; 792 tf_tour_archive_single_item( $adults, $child, $check_in_out ); 793 794 } else { 795 796 tf_tour_archive_single_item(); 797 798 } 799 800 $not_found[] = 0; 801 802 } else { 803 804 $not_found[] = 1; 805 806 } 807 808 } 721 809 ?> -
tourfic/trunk/inc/functions/shortcodes.php
r2715826 r2742744 120 120 <div class="recomended_place_info_header"> 121 121 <h3><?php _e( $term->name ); ?></h3> 122 <p><?php printf( esc_html__( "%s hotels", 'tourfic' ), $term->count); ?></p>122 <p><?php printf( esc_html__( "%s tours", 'tourfic' ), $term->count); ?></p> 123 123 </div> 124 124 </div> … … 439 439 // Get post type 440 440 $post_type = isset( $_GET['type'] ) ? sanitize_text_field($_GET['type']) : ''; 441 if(empty($post_type)) { 442 _e('<h3>Please select fields from the search form!</h3>', 'tourfic'); 443 return; 444 } 441 445 // Get hotel location or tour destination 442 446 $taxonomy = $post_type == 'tf_hotel' ? 'hotel_location' : 'tour_destination'; 443 447 // Get place 444 448 $place = isset( $_GET['place'] ) ? sanitize_text_field($_GET['place']) : ''; 445 446 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; 449 // Get Adult 450 $adults = isset( $_GET['adults'] ) ? sanitize_text_field($_GET['adults']) : ''; 451 // Get Child 452 $child = isset( $_GET['children'] ) ? sanitize_text_field($_GET['children']) : ''; 453 // Get Room 454 $room = isset( $_GET['room'] ) ? sanitize_text_field($_GET['room']) : ''; 455 // Get date 456 $check_in_out = isset( $_GET['check-in-out-date'] ) ? sanitize_text_field($_GET['check-in-out-date']) : ''; 457 458 $data = array($adults, $child, $room, $check_in_out); 459 460 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; 461 $checkInOutDate = !empty( $_GET['check-in-out-date']) ? explode( ' to ', $_GET['check-in-out-date'] ) : ''; 462 if(!empty($checkInOutDate)) { 463 $period = new DatePeriod( 464 new DateTime( $checkInOutDate[0] ), 465 new DateInterval( 'P1D' ), 466 new DateTime( $checkInOutDate[1] . '23:59' ) 467 ); 468 } else { 469 $period = ''; 470 } 447 471 448 472 // Main Query args 449 473 $args = array( 450 'post_type' => $post_type,474 'post_type' => $post_type, 451 475 'post_status' => 'publish', 452 'paged' 476 'paged' => $paged, 453 477 ); 454 478 455 479 $taxonomy_query = new WP_Term_Query(array( 456 'taxonomy' 457 'orderby' 458 'order' 459 'hide_empty' 460 'slug' => sanitize_title($place, ''),480 'taxonomy' => $taxonomy, 481 'orderby' => 'name', 482 'order' => 'ASC', 483 'hide_empty' => false, 484 'slug' => sanitize_title($place, ''), 461 485 )); 462 486 … … 490 514 <div class="tf-action-top"> 491 515 <div class="tf-list-grid"> 492 <a href="#list-view" data-id="list-view" class="change-view" title=" List View"><?php echo tourfic_get_svg('list_view'); ?></a>493 <a href="#grid-view" data-id="grid-view" class="change-view" title=" Grid View"><?php echo tourfic_get_svg('grid_view'); ?></a>516 <a href="#list-view" data-id="list-view" class="change-view" title="<?php _e('List View', 'tourfic'); ?>"><i class="fas fa-list"></i></a> 517 <a href="#grid-view" data-id="grid-view" class="change-view" title="<?php _e('Grid View', 'tourfic'); ?>"><i class="fas fa-border-all"></i></a> 494 518 </div> 495 519 </div> 496 520 <div class="archive_ajax_result"> 497 521 <?php 498 if ( $loop->have_posts() ) { 499 while ( $loop->have_posts() ) { 500 $loop->the_post(); 501 502 if( $post_type == 'tf_hotel' ){ 503 tf_hotel_archive_single_item(); 504 }elseif( $post_type == 'tf_tours' ){ 505 //tour archive single gird/section added 506 tf_tour_archive_single_item(); 522 if ( $loop->have_posts() ) { 523 $not_found = []; 524 while ( $loop->have_posts() ) { 525 $loop->the_post(); 526 527 if ( $post_type == 'tf_hotel' ) { 528 529 if( empty( $check_in_out ) ) { 530 $not_found[] = 0; 531 tf_hotel_archive_single_item(); 532 } else { 533 tf_filter_hotel_by_date( $period, $not_found, $data ); 534 } 535 536 } else { 537 538 if( empty( $check_in_out ) ) { 539 $not_found[] = 0; 540 tf_tour_archive_single_item(); 541 } else { 542 tf_filter_tour_by_date( $period, $not_found, $data ); 543 } 544 545 } 546 507 547 } 508 548 549 if ( !in_array( 0, $not_found ) ) { 550 echo '<div class="tf-nothing-found">' . __( 'Nothing Found! Select another dates', 'tourfic' ) . '</div>'; 551 } 552 } else { 553 echo '<div class="tf-nothing-found">' . __( 'Nothing Found!', 'tourfic' ) . '</div>'; 509 554 } 510 } else {511 echo '<div class="tf-nothing-found">Nothing Found!</div>';512 }513 555 ?> 514 556 </div> … … 523 565 <?php return ob_get_clean(); 524 566 } 567 568 525 569 add_shortcode('tf_search_result', 'tf_search_result_shortcode'); 526 527 570 ?> -
tourfic/trunk/inc/functions/widgets.php
r2696074 r2742744 214 214 ?> 215 215 <div class="ni-buttons"> 216 <a href="<?php echo t ourfic_booking_search_action().'?destination='.esc_attr( $terms[0]->name ).'&adults='.$_GET['adults'].'&children='.$_GET['children'].'&room='.$_GET['room'].'&check-in-date='.$_GET['check-in-date'].'&check-out-date='.$_GET['check-out-date']; ?>" class="button tf_button btn-outline"><?php esc_html_e( $btn_label ); ?></a>216 <a href="<?php echo tf_booking_search_action().'?destination='.esc_attr( $terms[0]->name ).'&adults='.$_GET['adults'].'&children='.$_GET['children'].'&room='.$_GET['room'].'&check-in-date='.$_GET['check-in-date'].'&check-out-date='.$_GET['check-out-date']; ?>" class="button tf_button btn-outline"><?php esc_html_e( $btn_label ); ?></a> 217 217 </div> 218 218 </div> -
tourfic/trunk/inc/functions/woocommerce/wc-common.php
r2715826 r2742744 19 19 if ( 'check_in' === $meta->key ) { $key = __( 'Check-in Date', 'tourfic'); } 20 20 if ( 'check_out' === $meta->key ) { $key = __( 'Check-out Date', 'tourfic'); } 21 if ( '_tour_id' === $meta->key ) { $key = __( 'Tour ID', 'tourfic'); } 21 22 22 23 return $key; … … 33 34 function tf_hide_order_meta( $hidden_meta ) { 34 35 35 $hidden_meta = array('_order_type', '_post_author', '_post_id' );36 $hidden_meta = array('_order_type', '_post_author', '_post_id', '_unique_id'); 36 37 37 38 return $hidden_meta; -
tourfic/trunk/inc/functions/woocommerce/wc-hotel.php
r2715826 r2742744 7 7 * @since 2.2.0 8 8 */ 9 add_action( 'wp_ajax_tf_hotel_booking', 'tf_hotel_booking_callback');10 add_action( 'wp_ajax_nopriv_tf_hotel_booking', 'tf_hotel_booking_callback');9 add_action( 'wp_ajax_tf_hotel_booking', 'tf_hotel_booking_callback' ); 10 add_action( 'wp_ajax_nopriv_tf_hotel_booking', 'tf_hotel_booking_callback' ); 11 11 12 12 /** 13 13 * Handles AJAX for Booking 14 14 * 15 * @return string 15 * @return void 16 * @throws Exception 16 17 */ 17 18 function tf_hotel_booking_callback(){ … … 23 24 24 25 // Declaring errors & hotel data array 25 $response = array(); 26 $tf_room_data = array(); 27 $post_id = isset( $_POST['post_id'] ) ? intval( sanitize_text_field( $_POST['post_id'] ) ) : null; 28 $room_id = isset( $_POST['room_id'] ) ? intval( sanitize_text_field( $_POST['room_id'] ) ) : null; 26 $response = []; 27 $tf_room_data = []; 28 29 30 /** 31 * Data from booking form 32 * 33 * With errors 34 */ 35 $post_id = isset( $_POST['post_id'] ) ? intval( sanitize_text_field( $_POST['post_id'] ) ) : null; 36 $room_id = isset( $_POST['room_id'] ) ? intval( sanitize_text_field( $_POST['room_id'] ) ) : null; 37 $unique_id = isset( $_POST['unique_id'] ) ? intval( sanitize_text_field( $_POST['unique_id'] ) ) : null; 38 $location = isset( $_POST['location'] ) ? sanitize_text_field( $_POST['location'] ) : ''; 39 // People number 40 $adult = isset( $_POST['adult'] ) ? intval( sanitize_text_field( $_POST['adult'] ) ) : '0'; 41 $child = isset( $_POST['child'] ) ? intval( sanitize_text_field( $_POST['child'] ) ) : '0'; 42 $room_selected = isset( $_POST['room'] ) ? intval( sanitize_text_field( $_POST['room'] ) ) : '0'; 43 $check_in = isset( $_POST['check_in_date'] ) ? sanitize_text_field( $_POST['check_in_date'] ) : ''; 44 $check_out = isset( $_POST['check_out_date'] ) ? sanitize_text_field( $_POST['check_out_date'] ) : ''; 45 46 47 # Calculate night number 48 if($check_in && $check_out) { 49 $check_in_stt = strtotime( $check_in ); 50 $check_out_stt = strtotime( $check_out ); 51 $day_difference = round( ( ( $check_out_stt - $check_in_stt ) / ( 60 * 60 * 24 ) ) + 1 ); 52 } 53 54 // Check errors 55 if ( !$check_in ) { 56 $response['errors'][] = __('Check-in date missing.','tourfic'); 57 } 58 if ( !$check_out ) { 59 $response['errors'][] = __('Check-out date missing.','tourfic'); 60 } 61 if ( !$adult ) { 62 $response['errors'][] = __('Select Adult(s).','tourfic'); 63 } 64 if ( !$room_selected ) { 65 $response['errors'][] = __('Select Room(s).','tourfic'); 66 } 67 if ( !$post_id ) { 68 $response['errors'][] = __('Unknown Error! Please try again.','tourfic'); 69 } 29 70 30 71 /** … … 33 74 * @since 2.2.0 34 75 */ 35 $post_author = get_post_field( 'post_author', $post_id ); 36 $meta = get_post_meta( $post_id, 'tf_hotel', true ); 37 $rooms = !empty($meta['room']) ? $meta['room'] : ''; 38 $room_name = $rooms[$room_id]['title']; 39 $pricing_by = $rooms[$room_id]['pricing-by']; 40 $price_multi_day = !empty($rooms[$room_id]['price_multi_day']) ? $rooms[$room_id]['price_multi_day'] : false; 76 $product_id = get_post_meta( $post_id, 'product_id', true ); 77 $post_author = get_post_field( 'post_author', $post_id ); 78 $meta = get_post_meta( $post_id, 'tf_hotel', true ); 79 $rooms = !empty( $meta['room'] ) ? $meta['room'] : ''; 80 $avail_by_date = !empty( $rooms[$room_id]['avil_by_date'] ) && $rooms[$room_id]['avil_by_date']; 81 if ( $avail_by_date ) { 82 $repeat_by_date = !empty( $rooms[$room_id]['repeat_by_date'] ) ? $rooms[$room_id]['repeat_by_date'] : []; 83 } 84 $room_name = $rooms[$room_id]['title']; 85 $pricing_by = $rooms[$room_id]['pricing-by']; 86 $price_multi_day = !empty( $rooms[$room_id]['price_multi_day'] ) ? $rooms[$room_id]['price_multi_day'] : false; 87 41 88 42 89 /** 43 * All form data 44 * 90 * If no errors then process 45 91 */ 46 $location = isset( $_POST['location'] ) ? sanitize_text_field( $_POST['location'] ) : ''; 47 // People number 48 $adult = isset( $_POST['adult'] ) ? intval( sanitize_text_field( $_POST['adult'] ) ) : '0'; 49 $child = isset( $_POST['child'] ) ? intval( sanitize_text_field( $_POST['child'] ) ) : '0'; 50 $room_selected = isset( $_POST['room'] ) ? intval( sanitize_text_field( $_POST['room'] ) ) : '0'; 51 $check_in = isset( $_POST['check_in_date'] ) ? sanitize_text_field( $_POST['check_in_date'] ) : ''; 52 $check_out = isset( $_POST['check_out_date'] ) ? sanitize_text_field( $_POST['check_out_date'] ) : ''; 53 if($check_in && $check_out) { 54 $check_in_stt = strtotime($check_in); 55 $check_out_stt = strtotime($check_out); 56 $day_difference = round((($check_out_stt - $check_in_stt) / (60 * 60 * 24)) + 1); 57 } 58 59 // Check errors 60 if ( !$check_in ) { 61 $response['errors'][] = __('Check-in date missing.','tourfic'); 62 } 63 if ( !$check_out ) { 64 $response['errors'][] = __('Check-out date missing.','tourfic'); 65 } 66 if ( !$adult ) { 67 $response['errors'][] = __('Select Adult(s).','tourfic'); 68 } 69 if ( !$room_selected ) { 70 $response['errors'][] = __('Select Room(s).','tourfic'); 71 } 72 if ( !$post_id ) { 73 $response['errors'][] = __('Unknown Error! Please try again.','tourfic'); 74 } 75 //$response['errors'][] = $price_multi_day; 76 77 $post_title = get_the_title( $post_id ); 78 79 // Add Product 80 $product_arr = apply_filters( 'tf_create_product_array', array( 81 'post_title' => $post_title, 82 'post_type' => 'product', 83 'post_status' => 'publish', 84 'post_password' => tourfic_proctected_product_pass(), 85 'meta_input' => array( 86 '_price' => '0', 87 '_regular_price' => '0', 88 '_visibility' => 'visible', 89 '_virtual' => 'yes', 90 '_sold_individually' => 'yes', 91 ) 92 ) ); 93 94 $product_id = post_exists( $post_title,'','','product'); 95 96 if ( $product_id ) { 97 $response['product_status'] = 'exists'; 98 } else { 99 $product_id = wp_insert_post( $product_arr ); 100 if( !is_wp_error($product_id) ){ 101 $response['product_status'] = 'new'; 102 }else{ 103 $response['errors'][] = $product_id->get_error_message(); 104 $response['status'] = 'error'; 92 if( !array_key_exists('errors', $response) || count($response['errors']) == 0 ) { 93 94 $tf_room_data['tf_hotel_data']['order_type'] = 'hotel'; 95 $tf_room_data['tf_hotel_data']['post_id'] = $post_id; 96 $tf_room_data['tf_hotel_data']['unique_id'] = $unique_id; 97 $tf_room_data['tf_hotel_data']['post_permalink'] = get_permalink( $post_id ); 98 $tf_room_data['tf_hotel_data']['post_author'] = $post_author; 99 $tf_room_data['tf_hotel_data']['post_id'] = $post_id; 100 $tf_room_data['tf_hotel_data']['location'] = $location; 101 $tf_room_data['tf_hotel_data']['adult'] = $adult; 102 $tf_room_data['tf_hotel_data']['child'] = $child; 103 $tf_room_data['tf_hotel_data']['check_in'] = $check_in; 104 $tf_room_data['tf_hotel_data']['check_out'] = $check_out; 105 $tf_room_data['tf_hotel_data']['room'] = $room_selected; 106 $tf_room_data['tf_hotel_data']['room_name'] = $room_name; 107 108 109 /** 110 * Calculate Pricing 111 */ 112 if ( $avail_by_date && defined( 'TF_PRO' ) ) { 113 114 // Check availability by date option 115 $period = new DatePeriod( 116 new DateTime( $check_in . ' 00:00' ), 117 new DateInterval( 'P1D' ), 118 new DateTime( $check_out . ' 23:59' ) 119 ); 120 $total_price = 0; 121 foreach ( $period as $date ) { 122 123 $available_rooms = array_values( array_filter( $repeat_by_date, function ($date_availability ) use ( $date ) { 124 $date_availability_from = strtotime( $date_availability['availability']['from'] . ' 00:00' ); 125 $date_availability_to = strtotime( $date_availability['availability']['to'] . ' 23:59' ); 126 return strtotime( $date->format( 'd-M-Y' ) ) >= $date_availability_from && strtotime( $date->format( 'd-M-Y' ) ) <= $date_availability_to; 127 } ) ); 128 129 if ( is_iterable($available_rooms) && count( $available_rooms ) >=1) { 130 $room_price = !empty( $available_rooms[0]['price'] ) ? $available_rooms[0]['price'] : $rooms[$room_id]['price']; 131 $adult_price = !empty( $available_rooms ) ? $available_rooms[0]['adult_price'] : $rooms[$room_id]['adult_price']; 132 $child_price = !empty( $available_rooms ) ? $available_rooms[0]['child_price'] : $rooms[$room_id]['child_price']; 133 $total_price += $pricing_by == '1' ? $room_price : ( ( $adult_price * $adult ) + ( $child_price * $child ) ); 134 } ; 135 } 136 137 $price_total = $total_price*$room_selected; 138 139 } else { 140 141 if ( $pricing_by == '1' ) { 142 $total_price = $rooms[$room_id]['price']; 143 } elseif ( $pricing_by == '2' ) { 144 $adult_price = $rooms[$room_id]['adult_price']; 145 $adult_price = $adult_price * $adult; 146 $child_price = $rooms[$room_id]['child_price']; 147 $child_price = $child_price * $child; 148 $total_price = $adult_price + $child_price; 149 } 150 151 # Multiply pricing by night number 152 if(!empty($day_difference) && $price_multi_day == true) { 153 $price_total = $total_price*$room_selected*$day_difference; 154 } else { 155 $price_total = $total_price*$room_selected; 156 } 157 105 158 } 106 } 107 108 //echo var_dump($rooms); 109 110 //$response['errors'][] = $pricing_by; 111 // If no errors then process 112 if(!array_key_exists('errors', $response) || count($response['errors']) == 0) { 113 114 $tf_room_data['tf_hotel_data']['order_type'] = 'hotel'; 115 $tf_room_data['tf_hotel_data']['post_author'] = $post_author; 116 $tf_room_data['tf_hotel_data']['post_id'] = $post_id; 117 $tf_room_data['tf_hotel_data']['location'] = $location; 118 $tf_room_data['tf_hotel_data']['adult'] = $adult; 119 $tf_room_data['tf_hotel_data']['child'] = $child; 120 $tf_room_data['tf_hotel_data']['check_in'] = $check_in; 121 $tf_room_data['tf_hotel_data']['check_out'] = $check_out; 122 $tf_room_data['tf_hotel_data']['room'] = $room_selected; 123 $tf_room_data['tf_hotel_data']['room_name'] = $room_name; 124 125 if ($pricing_by == '1') { 126 $total_price = $rooms[$room_id]['price']; 127 } elseif ($pricing_by == '2') { 128 $adult_price = $rooms[$room_id]['adult_price']; 129 $adult_price = $adult_price * $adult; 130 $child_price = $rooms[$room_id]['child_price']; 131 $child_price = $child_price * $child; 132 $total_price = $adult_price + $child_price; 133 } 134 if(!empty($day_difference) && $price_multi_day == true) { 135 $price_total = $total_price*$room_selected*$day_difference; 136 } else { 137 $price_total = $total_price*$room_selected; 138 } 139 159 160 # Set pricing 140 161 $tf_room_data['tf_hotel_data']['price_total'] = $price_total; 141 142 // If want to empty the cart 143 //WC()->cart->empty_cart(); 144 145 // Add product to cart with the custom cart item data 146 WC()->cart->add_to_cart( $product_id, 1, '0', array(), $tf_room_data ); 162 # Add product to cart with the custom cart item data 163 WC()->cart->add_to_cart( $post_id, 1, '0', array(), $tf_room_data ); 147 164 148 165 $response['product_id'] = $product_id; … … 153 170 } 154 171 155 //ppr($get_room_type);156 157 172 // Json Response 158 173 echo wp_json_encode( $response ); … … 161 176 } 162 177 163 // Set price 164 function set_order_price( $cart ) { 178 /** 179 * Over write WooCommerce Price 180 */ 181 function tf_hotel_set_order_price( $cart ) { 182 165 183 if ( is_admin() && ! defined( 'DOING_AJAX' ) ) 166 184 return; … … 171 189 foreach ( $cart->get_cart() as $cart_item ) { 172 190 173 if( isset( $cart_item['tf_hotel_data']['price_total']) ){191 if( isset( $cart_item['tf_hotel_data']['price_total'] ) ){ 174 192 $cart_item['data']->set_price( $cart_item['tf_hotel_data']['price_total'] ); 175 193 } … … 177 195 178 196 } 179 add_action( 'woocommerce_before_calculate_totals', 'set_order_price', 30, 1 );197 add_action( 'woocommerce_before_calculate_totals', 'tf_hotel_set_order_price', 30, 1 ); 180 198 181 199 // Display custom cart item meta data (in cart and checkout) … … 225 243 226 244 return $item_data; 245 227 246 } 228 247 add_filter( 'woocommerce_get_item_data', 'display_cart_item_custom_meta_data', 10, 2 ); … … 239 258 240 259 return $permalink; 241 } 242 add_filter ('woocommerce_cart_item_permalink', 'tf_hotel_cart_item_permalink' , 10, 3 ); 260 261 } 262 add_filter ( 'woocommerce_cart_item_permalink', 'tf_hotel_cart_item_permalink' , 10, 3 ); 243 263 244 264 /** … … 251 271 $post_author = $values['tf_hotel_data']['post_author']; 252 272 $post_id = !empty($values['tf_hotel_data']['post_id']) ? $values['tf_hotel_data']['post_id'] : ''; 273 $unique_id = !empty($values['tf_hotel_data']['unique_id']) ? $values['tf_hotel_data']['unique_id'] : ''; 253 274 $room_name = !empty($values['tf_hotel_data']['room_name']) ? $values['tf_hotel_data']['room_name'] : ''; 254 275 $room_selected = !empty($values['tf_hotel_data']['room']) ? $values['tf_hotel_data']['room'] : ''; … … 274 295 } 275 296 297 if ( $unique_id ) { 298 $item->update_meta_data( '_unique_id', $unique_id ); 299 } 300 276 301 if ($room_name) { 277 302 278 $item->update_meta_data( __('room_name', 'tourfic'), $room_name );303 $item->update_meta_data( 'room_name', $room_name ); 279 304 } 280 305 281 306 if ( $room_selected && $room_selected > 0 ) { 282 307 283 $item->update_meta_data( __('number_room_booked', 'tourfic'), $room_selected );308 $item->update_meta_data( 'number_room_booked', $room_selected ); 284 309 } 285 310 286 311 if ( $adult && $adult > 0 ) { 287 312 288 $item->update_meta_data( __('adult', 'tourfic'), $adult );313 $item->update_meta_data( 'adult', $adult ); 289 314 } 290 315 291 316 if ( $child && $child > 0 ) { 292 317 293 $item->update_meta_data( __('child', 'tourfic'), $child );318 $item->update_meta_data( 'child', $child ); 294 319 } 295 320 296 321 if ( $check_in ) { 297 322 298 $item->update_meta_data( __('check_in', 'tourfic'), $check_in );323 $item->update_meta_data( 'check_in', $check_in ); 299 324 } 300 325 301 326 if ( $check_out ) { 302 327 303 $item->update_meta_data( __('check_out', 'tourfic'), $check_out );328 $item->update_meta_data( 'check_out', $check_out ); 304 329 } 305 330 306 331 } 307 332 add_action( 'woocommerce_checkout_create_order_line_item', 'tf_hotel_custom_order_data', 10, 4 ); 333 334 /** 335 * Add order id to the hotel room meta field 336 * 337 * runs during WooCommerce checkout process 338 * 339 * @author fida 340 */ 341 function tf_add_order_id_room_checkout_order_processed( $order_id, $posted_data, $order ) { 342 343 # Get and Loop Over Order Line Items 344 foreach ( $order->get_items() as $item_id => $item ) { 345 346 $post_id = $item->get_meta( '_post_id', true ); // Hotel id 347 $unique_id = $item->get_meta( '_unique_id', true ); // Unique id of rooms 348 $meta = get_post_meta( $post_id, 'tf_hotel', true ); // Hotel meta 349 $rooms = !empty($meta['room']) ? $meta['room'] : ''; 350 $new_rooms = []; 351 352 # Get and Loop Over Room Meta 353 foreach($rooms as $room) { 354 355 # Check if order is for this room 356 if($room['unique_id'] == $unique_id){ 357 358 $old_order_id = $room['order_id']; 359 360 $old_order_id != "" && $old_order_id .= ","; 361 $old_order_id .= $order_id; 362 363 # set old + new data to the oder_id meta 364 $room['order_id'] = $old_order_id; 365 } 366 367 # Set whole room array 368 $new_rooms[] = $room; 369 } 370 371 # Set whole room array to the room meta 372 $meta['room'] = $new_rooms; 373 # Update hotel post meta with array values 374 update_post_meta( $post_id, 'tf_hotel', $meta ); 375 376 } 377 } 378 add_action( 'woocommerce_checkout_order_processed', 'tf_add_order_id_room_checkout_order_processed', 10, 3 ); 308 379 ?> -
tourfic/trunk/inc/functions/woocommerce/wc-tour.php
r2715826 r2742744 21 21 */ 22 22 $post_id = isset( $_POST['post_id'] ) ? intval( sanitize_text_field( $_POST['post_id'] ) ) : ''; 23 $product_id = get_post_meta( $post_id, 'product_id', true ); 23 24 $post_author = get_post_field( 'post_author', $post_id ); 24 25 $meta = get_post_meta( $post_id, 'tf_tours_option', true ); … … 53 54 } elseif ($tour_type == 'continuous') { 54 55 55 $custom_avail = !empty($meta['custom_avail']) ? $meta['custom_avail'] : '';56 $custom_avail = !empty($meta['custom_avail']) ? $meta['custom_avail'] : false; 56 57 57 58 if ($custom_avail == true) { 58 59 60 $pricing_rule = $meta['custom_pricing_by']; 59 61 $cont_custom_date = !empty($meta['cont_custom_date']) ? $meta['cont_custom_date'] : ''; 60 62 … … 99 101 $start_date = $end_date = $tour_date; 100 102 } 103 101 104 // Tour extra 102 105 $tour_extra_total = !empty( $_POST['tour_extra_total'] ) ? sanitize_text_field( $_POST['tour_extra_total'] ) : ''; … … 187 190 } 188 191 189 // Get product title from post id 190 $post_title = get_the_title( $post_id ); 191 192 /** 193 * Create tours as WooCommerce product 194 * 195 * Password protected 196 */ 197 // Arguments 198 $product_arr = apply_filters( 'tf_create_product_array', array( 199 'post_title' => $post_title, 200 'post_type' => 'product', 201 'post_status' => 'publish', 202 'post_password' => tourfic_proctected_product_pass(), 203 'meta_input' => array( 204 '_price' => '0', 205 '_regular_price' => '0', 206 '_visibility' => 'visible', 207 '_virtual' => 'yes', 208 '_sold_individually' => 'yes', 209 ), 210 ) ); 211 212 $product_id = post_exists( $post_title, '', '', 'product' ); 213 214 // Check if product already exists 215 if ( $product_id ) { 216 $response['product_status'] = 'exists'; 217 } else { 218 $product_id = wp_insert_post( $product_arr ); 219 220 if ( !is_wp_error( $product_id ) ) { 221 $response['product_status'] = 'new'; 222 } else { 223 $response['errors'][] = $product_id->get_error_message(); 224 $response['status'] = 'error'; 225 } 226 } 227 228 /** 229 * Seasional price 230 * 192 /** 193 * Price by date range 194 * 195 * Tour type continuous and custom availability is true 231 196 */ 232 197 $tour = strtotime($tour_date); … … 236 201 return $seasion_start <= $tour && $seasion_end >= $tour; 237 202 })); 203 238 204 if ($tour_type === 'continuous' && !empty($meta['cont_custom_date']) && !empty($seasional_price)) { 239 $pricing_rule = $seasional_price[0]['pricing']; 205 240 206 $group_price = $seasional_price[0]['group_price']; 241 207 $adult_price = $seasional_price[0]['adult_price']; 242 208 $children_price = $seasional_price[0]['child_price']; 243 209 $infant_price = $seasional_price[0]['infant_price']; 210 244 211 } else { 245 $pricing_rule = !empty($meta['pricing']) ? $meta['pricing'] : ''; 212 246 213 $group_price = !empty($meta['group_price']) ? $meta['group_price'] : ''; 247 214 $adult_price = !empty($meta['adult_price']) ? $meta['adult_price'] : ''; 248 215 $children_price = !empty($meta['child_price']) ? $meta['child_price'] : ''; 249 216 $infant_price = !empty($meta['infant_price']) ? $meta['infant_price'] : ''; 217 250 218 } 251 219 … … 261 229 262 230 if((!empty($custom_avail ) && $custom_avail == true) || $pricing_rule == 'person') { 231 263 232 if (!$disable_adult_price && $adults > 0 && empty($adult_price)) $response['errors'][] = __('Adult price is blank!', 'tourfic'); 264 233 if (!$disable_child_price && $children > 0 && empty($children_price)) $response['errors'][] = __('Childern price is blank!', 'tourfic'); 265 234 if (!$disable_infant_price && $infant > 0 && empty($infant_price)) $response['errors'][] = __('Infant price is blank!', 'tourfic'); 266 235 if ($infant > 0 && !empty($infant_price) && !$adults) $response['errors'][] = __('Infant without adults is not allowed!', 'tourfic'); 236 267 237 } else if((!empty($custom_avail ) && $custom_avail == true) || $pricing_rule == 'group') { 268 if (empty($group_price)) $response['errors'][] = __('Group price is blank!', 'tourfic'); 269 } 270 // End of seasional price 238 239 if (empty($group_price)) $response['errors'][] = __('Group price is blank!', 'tourfic'); 240 241 } 271 242 272 243 /** … … 278 249 if (!array_key_exists('errors', $response) || count($response['errors']) == 0) { 279 250 280 $tf_tours_data['tf_tours_data']['order_type'] = 'tour'; 281 $tf_tours_data['tf_tours_data']['post_author'] = $post_author; 282 $tf_tours_data['tf_tours_data']['tour_type'] = $tour_type; 283 $tf_tours_data['tf_tours_data']['tour_id'] = $post_id; 284 285 $tf_tours_data['tf_tours_data']['adults'] = $adults; 286 $tf_tours_data['tf_tours_data']['childrens'] = $children; 287 $tf_tours_data['tf_tours_data']['infants'] = $infant; 251 $tf_tours_data['tf_tours_data']['order_type'] = 'tour'; 252 $tf_tours_data['tf_tours_data']['post_author'] = $post_author; 253 $tf_tours_data['tf_tours_data']['tour_type'] = $tour_type; 254 $tf_tours_data['tf_tours_data']['tour_id'] = $post_id; 255 $tf_tours_data['tf_tours_data']['post_permalink'] = get_permalink($post_id); 256 257 $tf_tours_data['tf_tours_data']['adults'] = $adults; 258 $tf_tours_data['tf_tours_data']['childrens'] = $children; 259 $tf_tours_data['tf_tours_data']['infants'] = $infant; 288 260 $tf_tours_data['tf_tours_data']['start_date'] = $start_date; 289 $tf_tours_data['tf_tours_data']['end_date'] = $end_date;290 $tf_tours_data['tf_tours_data']['tour_date'] = $tour_date;261 $tf_tours_data['tf_tours_data']['end_date'] = $end_date; 262 $tf_tours_data['tf_tours_data']['tour_date'] = $tour_date; 291 263 292 264 $tf_tours_data['tf_tours_data']['tour_extra_total'] = $tour_extra_total; 293 265 $tf_tours_data['tf_tours_data']['tour_extra_title'] = $tour_extra_title; 294 266 295 $discount_type = $meta['discount_type']; 296 $discounted_price = $meta['discount_price']; 297 $pricing_rule = $meta['pricing']; 298 $group_price = $meta['group_price']; 299 $adult_price = $meta['adult_price']; 300 $children_price = $meta['child_price']; 301 $infant_price = $meta['infant_price']; 302 267 # Discount informations 268 $discount_type = !empty($meta['discount_type']) ? $meta['discount_type'] : ''; 269 $discounted_price = !empty($meta['discount_price']) ? $meta['discount_price'] : ''; 270 271 # Calculate discounted price 303 272 if ( $discount_type == 'percent' ) { 273 304 274 $adult_price = number_format( $adult_price - ( ( $adult_price / 100 ) * $discounted_price ), 1 ); 305 275 $children_price = number_format( $children_price - ( ( $children_price / 100 ) * $discounted_price ), 1 ); 306 276 $infant_price = number_format( $infant_price - ( ( $infant_price / 100 ) * $discounted_price ), 1 ); 307 277 $group_price = number_format( $group_price - ( ( $group_price / 100 ) * $discounted_price ), 1 ); 278 308 279 } elseif ( $discount_type == 'fixed' ) { 280 309 281 $adult_price = number_format( ( $adult_price - $discounted_price ), 1 ); 310 282 $children_price = number_format( ( $children_price - $discounted_price ), 1 ); 311 283 $infant_price = number_format( ( $infant_price - $discounted_price ), 1 ); 312 $infant_price = number_format( ( $infant_price - $discounted_price ), 1 );313 284 $group_price = number_format( ( $group_price - $discounted_price ), 1 ); 314 } 285 286 } 287 288 # Set pricing based on pricing rule 315 289 if ( $pricing_rule == 'group' ) { 290 316 291 $tf_tours_data['tf_tours_data']['price'] = $group_price; 292 317 293 } else { 294 318 295 $tf_tours_data['tf_tours_data']['price'] = ( $adult_price * $adults ) + ( $children * $children_price ) + ( $infant * $infant_price ); 296 319 297 } 320 298 321 299 // Add product to cart with the custom cart item data 322 WC()->cart->add_to_cart( $p roduct_id, 1, '0', array(), $tf_tours_data );300 WC()->cart->add_to_cart( $post_id, 1, '0', array(), $tf_tours_data ); 323 301 324 302 $response['product_id'] = $product_id; 325 303 $response['add_to_cart'] = 'true'; 326 304 $response['redirect_to'] = wc_get_checkout_url(); 305 327 306 } else { 307 308 # Show errors 328 309 $response['status'] = 'error'; 310 329 311 } 330 312 … … 332 314 echo wp_json_encode( $response ); 333 315 316 # Close ajax 334 317 die(); 335 318 } … … 338 321 * Set tour price in WooCommerce 339 322 */ 340 add_action( 'woocommerce_before_calculate_totals', 'tf_tours_set_order_price', 30, 1 );341 323 function tf_tours_set_order_price( $cart ) { 324 342 325 if ( is_admin() && !defined( 'DOING_AJAX' ) ) { 343 326 return; … … 355 338 $cart_item['data']->set_price( $cart_item['tf_tours_data']['price'] ); 356 339 } 340 357 341 } 358 342 } 343 add_action( 'woocommerce_before_calculate_totals', 'tf_tours_set_order_price', 30, 1 ); 359 344 360 345 /** … … 365 350 366 351 // Assigning data into variables 367 $tour_type = !empty($cart_item['tf_tours_data']['tour_type']) ? $cart_item['tf_tours_data']['tour_type'] : '';368 $adults_number = !empty($cart_item['tf_tours_data']['adults']) ? $cart_item['tf_tours_data']['adults'] : '';352 $tour_type = !empty($cart_item['tf_tours_data']['tour_type']) ? $cart_item['tf_tours_data']['tour_type'] : ''; 353 $adults_number = !empty($cart_item['tf_tours_data']['adults']) ? $cart_item['tf_tours_data']['adults'] : ''; 369 354 $childrens_number = !empty($cart_item['tf_tours_data']['childrens']) ? $cart_item['tf_tours_data']['childrens'] : ''; 370 $infants_number = !empty($cart_item['tf_tours_data']['infants']) ? $cart_item['tf_tours_data']['infants'] : '';371 $start_date = !empty($cart_item['tf_tours_data']['start_date']) ? $cart_item['tf_tours_data']['start_date'] : '';372 $end_date = !empty($cart_item['tf_tours_data']['end_date']) ? $cart_item['tf_tours_data']['end_date'] : '';373 $tour_date = !empty($cart_item['tf_tours_data']['tour_date']) ? $cart_item['tf_tours_data']['tour_date'] : '';374 $tour_extra = !empty($cart_item['tf_tours_data']['tour_extra_title']) ? $cart_item['tf_tours_data']['tour_extra_title'] : '';355 $infants_number = !empty($cart_item['tf_tours_data']['infants']) ? $cart_item['tf_tours_data']['infants'] : ''; 356 $start_date = !empty($cart_item['tf_tours_data']['start_date']) ? $cart_item['tf_tours_data']['start_date'] : ''; 357 $end_date = !empty($cart_item['tf_tours_data']['end_date']) ? $cart_item['tf_tours_data']['end_date'] : ''; 358 $tour_date = !empty($cart_item['tf_tours_data']['tour_date']) ? $cart_item['tf_tours_data']['tour_date'] : ''; 359 $tour_extra = !empty($cart_item['tf_tours_data']['tour_extra_title']) ? $cart_item['tf_tours_data']['tour_extra_title'] : ''; 375 360 376 361 /** … … 424 409 return $item_data; 425 410 } 426 427 /**428 * Change cart item permalink429 */430 function tf_tour_cart_item_permalink( $permalink, $cart_item, $cart_item_key ) {431 432 $tour_type = !empty($cart_item['tf_tours_data']['order_type']) ? $cart_item['tf_tours_data']['order_type'] : '';433 if ( is_cart() && $tour_type == 'tour') {434 $permalink = $cart_item['tf_tours_data']['post_permalink'];435 }436 437 return $permalink;438 }439 add_filter ('woocommerce_cart_item_permalink', 'tf_tour_cart_item_permalink' , 10, 3 );440 411 441 412 /** -
tourfic/trunk/readme.txt
r2728438 r2742744 4 4 Requires at least: 5.4 5 5 Tested up to: 6.0 6 Stable tag: 2. 46 Stable tag: 2.5 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 236 236 237 237 == Changelog == 238 239 = 2.5 - 15/06/2022 = 240 241 * Added: Multiply hotel room pricing by night 242 * Improved: Hotel/tour will be directly added to the WooCommerce cart/checkout 243 * Removed: Dependency on WooCommerce products. No product will be created for hotel/tour booking. 244 * Improved: All icons replaced with FontAwesome icons 245 * Fixed: Single tour pricing display issue 246 * Fixed: Several conditional bugs 247 * Updated: Several translation strings 248 * Removed: Some deprecated functions 249 * Fixed: Some CSS bugs 250 * Fixed: Elementor widget bugs 238 251 239 252 = 2.4 - 21/05/2022 = -
tourfic/trunk/templates/hotel/archive-hotels.php
r2696074 r2742744 19 19 <div class="tf_content"> 20 20 <div class="tf-action-top"> 21 22 <a href="#list-view" data-id="list-view" class="change-view" title=" List View"><?php echo tourfic_get_svg('list_view'); ?></a>23 <a href="#grid-view" data-id="grid-view" class="change-view" title=" Grid View"><?php echo tourfic_get_svg('grid_view'); ?></a>21 <div class="tf-list-grid"> 22 <a href="#list-view" data-id="list-view" class="change-view" title="<?php _e('List View', 'tourfic'); ?>"><i class="fas fa-list"></i></a> 23 <a href="#grid-view" data-id="grid-view" class="change-view" title="<?php _e('Grid View', 'tourfic'); ?>"><i class="fas fa-border-all"></i></a> 24 24 </div> 25 25 </div> … … 33 33 } 34 34 } else { 35 echo '<div class="tf-nothing-found"> Nothing Found!</div>';35 echo '<div class="tf-nothing-found">' .__("No Hotels Found!", "tourfic"). '</div>'; 36 36 } 37 37 ?> -
tourfic/trunk/templates/hotel/single-hotel.php
r2715192 r2742744 12 12 13 13 // get post id 14 $post_id = get_the_ID();14 $post_id = $post->ID; 15 15 16 16 /** … … 73 73 74 74 // Hotel Detail 75 //$featured = !empty($meta['featured']) ? $meta['featured'] : '';76 //$logo = !empty($meta['logo']) ? $meta['logo'] : '';77 75 $gallery = !empty($meta['gallery']) ? $meta['gallery'] : ''; 78 76 if ($gallery) { 79 // Comma seperated list to array 80 $gallery_ids = explode( ',', $gallery ); 77 $gallery_ids = explode( ',', $gallery ); // Comma seperated list to array 81 78 } 82 79 $video = !empty($meta['video']) ? $meta['video'] : ''; 83 84 80 // Room Details 85 81 $rooms = !empty($meta['room']) ? $meta['room'] : ''; 86 87 82 // FAQ 88 83 $faqs = !empty($meta['faq']) ? $meta['faq'] : ''; 89 90 84 // Terms & condition 91 85 $tc = !empty($meta['tc']) ? $meta['tc'] : ''; 92 86 93 87 $share_text = get_the_title(); 94 $share_link = esc_url( home_url("/?p=").$post_id ); 95 88 $share_link = get_permalink($post_id); 96 89 ?> 97 90 <div class="tourfic-wrap default-style" data-fullwidth="true"> … … 125 118 <?php if(!$disable_share_opt == '1') { ?> 126 119 <!-- Share Section --> 127 <div class=" share-tour">120 <div class="tf-share"> 128 121 <a href="#dropdown_share_center" class="share-toggle" 129 data-toggle="true">< ?php echo tourfic_get_svg('share'); ?></a>122 data-toggle="true"><i class="fas fa-share-alt"></i></a> 130 123 <div id="dropdown_share_center" class="share-tour-content"> 131 124 <ul class="tf-dropdown__content"> … … 133 126 <a href="http://www.facebook.com/share.php?u=<?php _e( $share_link ); ?>" 134 127 class="tf-dropdown__item" target="_blank"> 135 <span 136 class="tf-dropdown__item-content"><?php echo tourfic_get_svg('facebook'); ?> 137 <?php esc_html_e( 'Share on Facebook', 'tourfic' ); ?></span> 128 <span class="tf-dropdown__item-content"> 129 <i class="fab fa-facebook-square"></i> 130 <?php esc_html_e( 'Share on Facebook', 'tourfic' ); ?> 131 </span> 138 132 </a> 139 133 </li> … … 141 135 <a href="http://twitter.com/share?text=<?php _e( $share_text ); ?>&url=<?php _e( $share_link ); ?>" 142 136 class="tf-dropdown__item" target="_blank"> 143 <span 144 class="tf-dropdown__item-content"><?php echo tourfic_get_svg('twitter'); ?> 145 <?php esc_html_e( 'Share on Twitter', 'tourfic' ); ?></span> 137 <span class="tf-dropdown__item-content"> 138 <i class="fab fa-twitter-square"></i> 139 <?php esc_html_e( 'Share on Twitter', 'tourfic' ); ?> 140 </span> 146 141 </a> 147 142 </li> … … 288 283 $child_number = !empty($room['child']) ? $room['child'] : '0'; 289 284 $total_person = $adult_number + $child_number; 290 $pricing_by = !empty($room['pricing-by']) ? $room['pricing-by'] : ''; 291 ?> 285 $pricing_by = !empty($room['pricing-by']) ? $room['pricing-by'] : ''; 286 $avil_by_date = !empty( $room['avil_by_date'] ) ? !empty( $room['avil_by_date'] ) : false; 287 288 if($avil_by_date == true) { 289 290 $repeat_by_date = !empty( $room['repeat_by_date'] ) ? $room['repeat_by_date'] : []; 291 292 if ($pricing_by == '1') { 293 $prices = wp_list_pluck( $repeat_by_date, 'price' ); 294 } else { 295 $prices = wp_list_pluck( $repeat_by_date, 'adult_price' ); 296 } 297 298 $price = min( $prices ) != max( $prices ) ? wc_format_price_range( min( $prices ), max( $prices ) ) : wc_price( min( $prices ) ); 299 300 301 } else { 302 303 if ($pricing_by == '1') { 304 $price = wc_price( !empty($room['price']) ? $room['price'] : '0.0' ); 305 } else { 306 $price = wc_price( !empty($room['adult_price']) ? $room['adult_price'] : '0.0' ); 307 } 308 309 } 310 ?> 292 311 <tr> 293 312 <td class="description"> … … 388 407 <td class="pricing"> 389 408 <div class="tf-price-column"> 390 <?php if ($pricing_by == '1') { ?> 391 <span class="tf-price"><?php echo wc_price( $room['price'] ); ?></span> 392 <div class="price-per-night"><?php esc_html_e( 'per night', 'tourfic' ); ?> 393 </div> 394 <?php } elseif ($pricing_by == '2') { ?> 395 <span 396 class="tf-price"><?php echo wc_price( $room['adult_price'] ); ?></span> 397 <div class="price-per-night"> 398 <?php esc_html_e( 'per person/night', 'tourfic' ); ?></div> 399 <?php } ?> 409 <?php 410 if ($pricing_by == '1') { 411 ?> 412 <span class="tf-price"><?php echo $price; ?></span> 413 <div class="price-per-night"> 414 <?php esc_html_e( 'per night', 'tourfic' ); ?> 415 </div> 416 <?php 417 } else { 418 ?> 419 <span class="tf-price"><?php echo $price; ?></span> 420 <div class="price-per-night"> 421 <?php esc_html_e( 'per person/night', 'tourfic' ); ?> 422 </div> 423 <?php 424 } 425 ?> 400 426 </div> 401 427 </td> -
tourfic/trunk/templates/template-parts/archive.php
r2696074 r2742744 26 26 <div class="tf-action-top"> 27 27 <div class="tf-list-grid"> 28 <a href="#list-view" data-id="list-view" class="change-view" title=" List View"><?php echo tourfic_get_svg('list_view'); ?></a>29 <a href="#grid-view" data-id="grid-view" class="change-view" title=" Grid View"><?php echo tourfic_get_svg('grid_view'); ?></a>28 <a href="#list-view" data-id="list-view" class="change-view" title="<?php _e('List View', 'tourfic'); ?>"><i class="fas fa-list"></i></a> 29 <a href="#grid-view" data-id="grid-view" class="change-view" title="<?php _e('Grid View', 'tourfic'); ?>"><i class="fas fa-border-all"></i></a> 30 30 </div> 31 31 </div> … … 45 45 } 46 46 } else { 47 echo '<div class="tf-nothing-found"> Nothing Found!</div>';47 echo '<div class="tf-nothing-found">' .__("Nothing Found!", "tourfic"). '</div>'; 48 48 } 49 49 ?> -
tourfic/trunk/templates/tour/archive-tours.php
r2696074 r2742744 36 36 <div class="tf-action-top"> 37 37 <div class="tf-list-grid"> 38 <a href="#list-view" data-id="list-view" class="change-view" title=" List View"><?php echo tourfic_get_svg('list_view'); ?></a>39 <a href="#grid-view" data-id="grid-view" class="change-view" title=" Grid View"><?php echo tourfic_get_svg('grid_view'); ?></a>38 <a href="#list-view" data-id="list-view" class="change-view" title="<?php _e('List View', 'tourfic'); ?>"><i class="fas fa-list"></i></a> 39 <a href="#grid-view" data-id="grid-view" class="change-view" title="<?php _e('Grid View', 'tourfic'); ?>"><i class="fas fa-border-all"></i></a> 40 40 </div> 41 41 </div> … … 48 48 } 49 49 } else { 50 get_template_part( 'template-parts/content', 'none' );50 echo '<div class="tf-nothing-found">' .__("No Tours Found!", "tourfic"). '</div>'; 51 51 } 52 52 ?> -
tourfic/trunk/templates/tour/single-tour.php
r2715826 r2742744 18 18 * Show/hide sections 19 19 */ 20 $disable_review_sec = !empty($meta['t-review']) ? $meta['t-review'] : '';20 $disable_review_sec = !empty($meta['t-review']) ? $meta['t-review'] : ''; 21 21 $disable_related_tour = !empty($meta['t-related']) ? $meta['t-related'] : ''; 22 22 … … 24 24 * Get global settings value 25 25 */ 26 $s_review = !empty(tfopt('t-review')) ? tfopt('t-review') : '';26 $s_review = !empty(tfopt('t-review')) ? tfopt('t-review') : ''; 27 27 $s_related = !empty(tfopt('t-related')) ? tfopt('t-related') : ''; 28 28 … … 39 39 40 40 // Get destination 41 $destinations = get_the_terms( $post_id, 'tour_destination' );41 $destinations = get_the_terms( $post_id, 'tour_destination' ); 42 42 $first_destination_slug = !empty($destinations) ? $destinations[0]->slug : ''; 43 43 44 44 // Wishlist 45 $post_type = substr(get_post_type(), 3, -1);45 $post_type = substr(get_post_type(), 3, -1); 46 46 $has_in_wishlist = tf_has_item_in_wishlist($post_id); 47 47 48 48 // Address 49 $location = isset( $meta['location']['address'] ) ? $meta['location']['address'] : '';49 $location = isset( $meta['location']['address'] ) ? $meta['location']['address'] : ''; 50 50 $text_location = isset( $meta['text_location']) ? $meta['text_location'] : ''; 51 51 if( empty( $location ) ){ … … 62 62 $highlights = !empty($meta['additional_information']) ? $meta['additional_information'] : ''; 63 63 // Informations 64 $tour_duration = !empty($meta['duration']) ? $meta['duration'] : '';65 $tour_type = !empty($meta['info_type']) ? $meta['info_type'] : '';66 $group_size = !empty($meta['group_size']) ? $meta['group_size'] : '';67 $language = !empty($meta['language']) ? $meta['language'] : '';64 $tour_duration = !empty($meta['duration']) ? $meta['duration'] : ''; 65 $tour_type_info = !empty($meta['info_type']) ? $meta['info_type'] : ''; 66 $group_size = !empty($meta['group_size']) ? $meta['group_size'] : ''; 67 $language = !empty($meta['language']) ? $meta['language'] : ''; 68 68 69 69 $min_days = !empty($meta['min_days']) ? $meta['min_days'] : ''; 70 70 71 $faqs = $meta['faqs'] ? $meta['faqs'] : null;72 $inc = $meta['inc'] ? $meta['inc'] : null;73 $exc = $meta['exc'] ? $meta['exc'] : null;71 $faqs = $meta['faqs'] ? $meta['faqs'] : null; 72 $inc = $meta['inc'] ? $meta['inc'] : null; 73 $exc = $meta['exc'] ? $meta['exc'] : null; 74 74 $itineraries = $meta['itinerary'] ? $meta['itinerary'] : null; 75 75 //continuous tour … … 95 95 */ 96 96 $pricing_rule = !empty($meta['pricing']) ? $meta['pricing'] : ''; 97 $tour_type = !empty($meta['type']) ? $meta['type'] : '';97 $tour_type = !empty($meta['type']) ? $meta['type'] : ''; 98 98 if($tour_type && $tour_type == 'continuous') { 99 99 $custom_avail = !empty($meta['custom_avail']) ? $meta['custom_avail'] : false; 100 100 } 101 $discount_type = !empty($meta['discount_type']) ? $meta['discount_type'] : 'none'; 102 $discounted_price = !empty($meta['discount_price']) ? $meta['discount_price'] : ''; 103 $disable_adult = !empty($meta['disable_adult_price']) ? $meta['disable_adult_price'] : false; 104 $disable_child = !empty($meta['disable_child_price']) ? $meta['disable_child_price'] : false; 101 $discount_type = !empty($meta['discount_type']) ? $meta['discount_type'] : 'none'; 102 $disable_adult = !empty($meta['disable_adult_price']) ? $meta['disable_adult_price'] : false; 103 $disable_child = !empty($meta['disable_child_price']) ? $meta['disable_child_price'] : false; 105 104 $disable_infant = !empty($meta['disable_infant_price']) ? $meta['disable_infant_price'] : false; 106 $price = '0.0'; 107 108 /** 109 * Group price 110 */ 111 if($pricing_rule == 'group') { 112 113 $price = !empty($meta['group_price']) ? $meta['group_price'] : '0.0'; 114 115 if($discount_type == 'percent') { 116 $sale_price = number_format( $price - (( $price / 100 ) * $discounted_price) ,1 ); 117 } else if($discount_type == 'fixed') { 118 $sale_price = number_format( ( $price - $discounted_price ),1 ); 119 } 105 if($tour_type == 'continuous' && $custom_avail == true) { 106 $pricing_rule = !empty($meta['custom_pricing_by']) ? $meta['custom_pricing_by'] : 'person'; 120 107 } 121 108 122 /** 123 * Person price 124 */ 125 if($pricing_rule == 'person') { 126 127 $adult_price = !empty($meta['adult_price']) ? $meta['adult_price'] : ''; 128 $child_price = !empty($meta['child_price']) ? $meta['child_price'] : ''; 129 $infant_price = !empty($meta['infant_price']) ? $meta['infant_price'] : ''; 130 131 if($discount_type == 'percent') { 132 $adult_price ? $sale_adult_price = number_format( $adult_price - (( $adult_price / 100 ) * $discounted_price) ,1 ) : ''; 133 $child_price ? $sale_child_price = number_format( $child_price - (( $child_price / 100 ) * $discounted_price) ,1 ) : ''; 134 $infant_price ? $sale_infant_price = number_format( $infant_price - (( $infant_price / 100 ) * $discounted_price) ,1 ) : ''; 135 } else if($discount_type == 'fixed') { 136 $adult_price ? $sale_adult_price = number_format( ( $adult_price - $discounted_price ),1 ) : ''; 137 $child_price ? $sale_child_price = number_format( ( $child_price - $discounted_price ),1 ) : ''; 138 $infant_price ? $sale_infant_price = number_format( ( $infant_price - $discounted_price ),1 ) : ''; 139 } 140 } 141 142 if($tour_type == 'continuous' && $custom_avail == true) { 143 $pricing_rule = !empty($meta['cont_custom_date'][0]['pricing']) ? $meta['cont_custom_date'][0]['pricing'] : ''; 144 145 if($pricing_rule == 'group') { 146 147 $price = !empty($meta['cont_custom_date'][0]['group_price']) ? $meta['cont_custom_date'][0]['group_price'] : '0.0'; 148 149 if($discount_type == 'percent') { 150 $sale_price = number_format( $price - (( $price / 100 ) * $discounted_price) ,1 ); 151 } else if($discount_type == 'fixed') { 152 $sale_price = number_format( ( $price - $discounted_price ),1 ); 153 } 154 } 155 156 if($pricing_rule == 'person') { 157 158 $adult_price = !empty($meta['cont_custom_date'][0]['adult_price']) ? $meta['cont_custom_date'][0]['adult_price'] : ''; 159 $child_price = !empty($meta['cont_custom_date'][0]['child_price']) ? $meta['cont_custom_date'][0]['child_price'] : ''; 160 $infant_price = !empty($meta['cont_custom_date'][0]['infant_price']) ? $meta['cont_custom_date'][0]['infant_price'] : ''; 161 162 if($discount_type == 'percent') { 163 $adult_price ? $sale_adult_price = number_format( $adult_price - (( $adult_price / 100 ) * $discounted_price) ,1 ) : ''; 164 $child_price ? $sale_child_price = number_format( $child_price - (( $child_price / 100 ) * $discounted_price) ,1 ) : ''; 165 $infant_price ? $sale_infant_price = number_format( $infant_price - (( $infant_price / 100 ) * $discounted_price) ,1 ) : ''; 166 } else if($discount_type == 'fixed') { 167 $adult_price ? $sale_adult_price = number_format( ( $adult_price - $discounted_price ),1 ) : ''; 168 $child_price ? $sale_child_price = number_format( ( $child_price - $discounted_price ),1 ) : ''; 169 $infant_price ? $sale_infant_price = number_format( ( $infant_price - $discounted_price ),1 ) : ''; 170 } 171 } 172 } 173 109 # Get Pricing 110 $tour_price = new Tour_Price($meta); 174 111 ?> 175 112 … … 252 189 <div class="tf-hero-bottom-right"> 253 190 <div class="tf-single-tour-pricing"> 254 <?php 255 if($pricing_rule == 'group') {256 ?> 191 192 <?php if($pricing_rule == 'group') { ?> 193 257 194 <div class="tf-price group-price"> 258 195 <span class="sale-price"> 259 <?php echo wc_price($sale_price ?? $price, array('decimals'=>0)); ?>196 <?php echo $tour_price->wc_sale_group ?? $tour_price->wc_group; ?> 260 197 </span> 261 <?php echo ($discount_type != 'none') ? '<del>'. wc_price($price, array('decimals'=>0)).'</del>' : ''; ?>198 <?php echo ($discount_type != 'none') ? '<del>'.$tour_price->wc_group.'</del>' : ''; ?> 262 199 </div> 263 <?php 264 } else if($pricing_rule == 'person') { 265 ?> 266 <?php if(!$disable_adult && !empty($adult_price)) { ?> 200 201 <?php } elseif($pricing_rule == 'person') { ?> 202 203 <?php if(!$disable_adult && !empty($tour_price->adult)) { ?> 204 267 205 <div class="tf-price adult-price"> 268 206 <span class="sale-price"> 269 <?php echo wc_price($sale_adult_price ?? $adult_price, array('decimals'=>0)); ?>207 <?php echo $tour_price->wc_sale_adult ?? $tour_price->wc_adult; ?> 270 208 </span> 271 <?php echo ($discount_type != 'none') ? '<del>'. wc_price($adult_price, array('decimals'=>0)).'</del>' : ''; ?>209 <?php echo ($discount_type != 'none') ? '<del>'.$tour_price->wc_adult.'</del>' : ''; ?> 272 210 </div> 273 <?php } if(!$disable_child && !empty($child_price)) { ?> 211 212 <?php } if(!$disable_child && !empty($tour_price->child)) { ?> 213 274 214 <div class="tf-price child-price tf-d-n"> 275 215 <span class="sale-price"> 276 <?php echo wc_price($sale_child_price ?? $child_price, array('decimals'=>0)); ?>216 <?php echo $tour_price->wc_sale_child ?? $tour_price->wc_child; ?> 277 217 </span> 278 <?php echo ($discount_type != 'none') ? '<del>'. wc_price($child_price, array('decimals'=>0)).'</del>' : ''; ?>218 <?php echo ($discount_type != 'none') ? '<del>'.$tour_price->wc_child.'</del>' : ''; ?> 279 219 </div> 280 <?php } if(!$disable_infant && !empty($infant_price)) { ?> 220 221 <?php } if(!$disable_infant && !empty($tour_price->infant)) { ?> 222 281 223 <div class="tf-price infant-price tf-d-n"> 282 224 <span class="sale-price"> 283 <?php echo wc_price($sale_infant_price ?? $infant_price, array('decimals'=>0)); ?>225 <?php echo $tour_price->wc_sale_infant ?? $tour_price->wc_infant; ?> 284 226 </span> 285 <?php echo ($discount_type != 'none') ? '<del>'. wc_price($infant_price, array('decimals'=>0)).'</del>' : ''; ?>227 <?php echo ($discount_type != 'none') ? '<del>'.$tour_price->wc_infant.'</del>' : ''; ?> 286 228 </div> 229 287 230 <?php } ?> 288 231 <?php … … 295 238 echo '<li id="group" class="active">' .__("Group", "tourfic"). '</li>'; 296 239 297 } else 298 299 if(!$disable_adult && !empty($ adult_price)) {240 } elseif($pricing_rule == 'person') { 241 242 if(!$disable_adult && !empty($tour_price->adult)) { 300 243 echo '<li id="adult" class="active">' .__("Adult", "tourfic"). '</li>'; 301 } if(!$disable_child && !empty($ child_price)) {244 } if(!$disable_child && !empty($tour_price->child)) { 302 245 echo '<li id="child">' .__("Child", "tourfic"). '</li>'; 303 } if(!$disable_infant && !empty($ infant_price)) {246 } if(!$disable_infant && !empty($tour_price->infant)) { 304 247 echo '<li id="infant">' .__("Infant", "tourfic"). '</li>'; 305 248 } … … 318 261 319 262 320 <?php if($tour_duration || $tour_type || $group_size || $language) { ?>263 <?php if($tour_duration || $tour_type_info || $group_size || $language) { ?> 321 264 <!-- Square block section Start --> 322 265 <div class="tf-square-block-wrapper"> … … 331 274 </div> 332 275 <?php } ?> 333 <?php if($tour_type ) { ?>276 <?php if($tour_type_info) { ?> 334 277 <div class="tf-single-square-block"> 335 278 <img src=<?php echo TF_ASSETS_URL . "img/globe.png" ?> alt=""> 336 279 <h5><?php echo __( 'Tour Type', 'tourfic' ); ?></h5> 337 <p><?php echo esc_html__( $tour_type,'tourfic' )?></p>280 <p><?php echo $tour_type_info; ?></p> 338 281 </div> 339 282 <?php } ?> … … 563 506 while($tours->have_posts() ) { 564 507 $tours->the_post(); 565 $post_id = $post_id; 566 $destinations = get_the_terms( $post_id, 'tour_destination' ); 508 509 $post_id = get_the_ID(); 510 $destinations = get_the_terms( $post_id, 'tour_destination' ); 567 511 $first_destination_name = $destinations[0]->name; 568 569 $related_comments = get_comments( array( 'post_id' => $post_id ) ); 512 $related_comments = get_comments( array( 'post_id' => $post_id ) ); 513 $meta = get_post_meta( $post_id,'tf_tours_option',true ); 514 $pricing_rule = !empty($meta['pricing']) ? $meta['pricing'] : ''; 515 $disable_adult = !empty($meta['disable_adult_price']) ? $meta['disable_adult_price'] : false; 516 $disable_child = !empty($meta['disable_child_price']) ? $meta['disable_child_price'] : false; 517 $tour_price = new Tour_Price($meta); 570 518 ?> 571 <div class="tf-suggestion-item" style="background-image: url(<?php echo get_the_post_thumbnail_url( $post_id,'full')?>);">519 <div class="tf-suggestion-item" style="background-image: url(<?php echo get_the_post_thumbnail_url( $post_id, 'full' ); ?>);"> 572 520 <div class="tf-suggestion-content"> 573 521 <div class="tf-suggestion-desc"> … … 589 537 ?> 590 538 <div class="tf-suggestion-price"> 591 <span><?php echo tf_tours_price_html();?></span> 539 <span> 540 <?php if( $pricing_rule == 'group' ) { 541 542 echo $tour_price->wc_sale_group ?? $tour_price->wc_group; 543 544 } else if( $pricing_rule == 'person' ) { 545 546 if( !$disable_adult && !empty( $tour_price->adult ) ) { 547 548 echo $tour_price->wc_sale_adult ?? $tour_price->wc_adult; 549 550 } else if( !$disable_child && !empty( $tour_price->child ) ) { 551 552 echo $tour_price->wc_sale_child ?? $tour_price->wc_child; 553 554 } 555 556 } 557 ?> 558 </span> 592 559 </div> 593 560 </div> -
tourfic/trunk/tourfic.php
r2727840 r2742744 8 8 * Text Domain: tourfic 9 9 * Domain Path: /lang/ 10 * Version: 2. 411 * Tested up to: 5.9.312 * WC tested up to: 6. 5.110 * Version: 2.5 11 * Tested up to: 6.0 12 * WC tested up to: 6.6.0 13 13 * Requires PHP: 7.2 14 * Elementor tested up to: 3.6. 514 * Elementor tested up to: 3.6.6 15 15 */ 16 16 … … 93 93 */ 94 94 if ( !defined( 'TOURFIC' ) ) { 95 define( 'TOURFIC', '2. 4' );95 define( 'TOURFIC', '2.5' ); 96 96 } 97 97 … … 175 175 * All the requires 176 176 */ 177 // Classes 178 if ( file_exists( TF_INC_PATH . 'classes.php' ) ) { 179 require_once TF_INC_PATH . 'classes.php'; 180 } else { 181 tf_file_missing(TF_INC_PATH . 'classes.php'); 182 } 183 177 184 // Functions 178 185 if ( file_exists( TF_INC_PATH . 'functions.php' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.