| @@ -154,9 +154,9 @@ | ||
| 154 | 154 | $this->add_control( |
| 155 | 155 | 'booking_hide_if_сhildrens_allowed_field', |
| 156 | 156 | [ |
| 157 | 157 | 'label' => esc_html__('Childrens allowed field hide', 'wpdirectorykit'), |
| 158 | - 'type' => Controls_Manager::SWITCHER, | |
| 158 | + 'type' => Controls_Manager::HIDDEN, | |
| 159 | 159 | 'none' => esc_html__('Yes', 'wpdirectorykit'), |
| 160 | 160 | 'block' => esc_html__('No', 'wpdirectorykit'), |
| 161 | 161 | 'return_value' => 'yes', |
| 162 | 162 | 'default' => '', |
| @@ -173,8 +173,20 @@ | ||
| 173 | 173 | 'return_value' => 'yes', |
| 174 | 174 | 'default' => '', |
| 175 | 175 | ] |
| 176 | 176 | ); |
| 177 | + | |
| 178 | + $this->add_control( | |
| 179 | + 'booking_hide_count_childs_field', | |
| 180 | + [ | |
| 181 | + 'label' => esc_html__('Hide booking field count childs', 'wpdirectorykit'), | |
| 182 | + 'type' => Controls_Manager::SWITCHER, | |
| 183 | + 'none' => esc_html__('Yes', 'wpdirectorykit'), | |
| 184 | + 'block' => esc_html__('No', 'wpdirectorykit'), | |
| 185 | + 'return_value' => 'yes', | |
| 186 | + 'default' => '', | |
| 187 | + ] | |
| 188 | + ); | |
| 177 | 189 | $this->end_controls_section(); |
| 178 | 190 | } |
| 179 | 191 | |
| 180 | 192 | /** |
| @@ -196,9 +208,9 @@ | ||
| 196 | 208 | foreach ($settings['form_fields'] as $field) { |
| 197 | 209 | |
| 198 | 210 | $field_name = ''; |
| 199 | 211 | |
| 200 | - if(empty($field['field_id'])) { | |
| 212 | + if(!empty($field['field_id'])) { | |
| 201 | 213 | $field_name = $field['field_id']; |
| 202 | 214 | } |
| 203 | 215 | |
| 204 | 216 | if(empty($field_name)) { |
| @@ -235,9 +247,9 @@ | ||
| 235 | 247 | global $Winter_MVC_wdk_bookings; |
| 236 | 248 | |
| 237 | 249 | $Winter_MVC_wdk_bookings->model('calendar_m'); |
| 238 | 250 | $Winter_MVC_wdk_bookings->model('reservation_m'); |
| 239 | - $calendar = $Winter_MVC_wdk_bookings->calendar_m->get_pagination(NULL, NULL, array('post_id' => $wdk_listing_id)); | |
| 251 | + $calendar = $Winter_MVC_wdk_bookings->calendar_m->get_pagination(NULL, NULL, array('post_id' => $wdk_listing_id, 'is_activated' => 1)); | |
| 240 | 252 | |
| 241 | 253 | $dates = $Winter_MVC_wdk_bookings->reservation_m->get_enabled_dates($wdk_listing_id); |
| 242 | 254 | $dates = (str_replace("'",'',join(' ',$dates))); |
| 243 | 255 | |
| @@ -245,26 +257,40 @@ | ||
| 245 | 257 | $this->content ['wlisting_fields'] ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> |
| 246 | 258 | <div class="wdk_booking_auto_calculate_price"></div> |
| 247 | 259 | </div>'. $this->content ['wlisting_fields']; |
| 248 | 260 | |
| 261 | + if(wdk_get_option('wdk_bookings_enable_woocommerce_payments') && wc_get_cart_url() == home_url()) { | |
| 262 | + $this->content ['wlisting_fields'] .= '<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> | |
| 263 | + <div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger">'.esc_html__('Missing cart page in WooCommerce, please configure by guide','wpdirectorykit').'</div> | |
| 264 | + </div>'; | |
| 265 | + } | |
| 266 | + | |
| 267 | + | |
| 249 | 268 | if( $calendar && isset($calendar[0]) ) |
| 250 | - if( !is_user_logged_in() && ((isset($settings['booking_hide_if_not_login']) && !$settings['booking_hide_if_not_login'] == 'yes') || wmvc_show_data('is_disable_for_not_login',$calendar[0],false, TRUE, TRUE))){ | |
| 269 | + if( !is_user_logged_in() && ((isset($settings['booking_hide_if_not_login']) && !$settings['booking_hide_if_not_login'] == 'yes') || wmvc_show_data('is_disable_for_not_login',$calendar[0],false, TRUE, TRUE) || wdk_get_option('wdk_booking_disable_for_not_login'))){ | |
| 251 | 270 | $this->content ['wlisting_fields'] .= '<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> |
| 252 | 271 | <a href="'.wdk_login_url(wdk_current_url()).'" class="wdk-booking"> |
| 253 | 272 | '.esc_html__('For Booking please login','wpdirectorykit').' |
| 254 | - </div></a>'; | |
| 273 | + </a></div>'; | |
| 255 | 274 | } else { |
| 256 | 275 | $calendar = $calendar[0]; |
| 257 | 276 | |
| 258 | - if(intval(wdk_get_option('wdk_bookings_max_guests')) > 0) { | |
| 277 | + if(!empty($calendar->guests)) { | |
| 278 | + $options = range(1, intval($calendar->guests)); | |
| 279 | + } elseif(intval(wdk_get_option('wdk_bookings_max_guests')) > 0) { | |
| 259 | 280 | $options = range(1, intval(wdk_get_option('wdk_bookings_max_guests'))); |
| 260 | - } else { | |
| 281 | + } else { | |
| 261 | 282 | $options = range(1, 10); |
| 262 | 283 | } |
| 263 | 284 | |
| 264 | 285 | if(empty($calendar->is_guests_disabled)) { |
| 265 | 286 | |
| 266 | - $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 287 | + if($settings['booking_hide_count_childs_field'] != 'yes' && !empty($calendar->is_children_acceptable) ) { | |
| 288 | + $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 289 | + } else { | |
| 290 | + $output ='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;">'; | |
| 291 | + } | |
| 292 | + | |
| 267 | 293 | $output .='<select name="guests_number_adults" id="guests_number_adults" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; |
| 268 | 294 | $output .= '<option value="">'.esc_html__('Adults','wpdirectorykit').'</option>'; |
| 269 | 295 | foreach ($options as $key => $option){ |
| 270 | 296 | if(!next($options)) { |
| @@ -275,20 +301,23 @@ | ||
| 275 | 301 | } |
| 276 | 302 | $output .='</select> |
| 277 | 303 | </div>'; |
| 278 | 304 | |
| 279 | - $output .='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 280 | - $output .='<select name="guests_number_childs" id="guests_number_childs" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; | |
| 281 | - $output .= '<option value="">'.esc_html__('Childs','wpdirectorykit').'</option>'; | |
| 282 | - foreach ($options as $key => $option){ | |
| 283 | - if(!next($options)) { | |
| 284 | - $output .= '<option value="'.esc_attr($option).'+">'.esc_html($option).'+</option>'; | |
| 285 | - } else { | |
| 286 | - $output .= '<option value="'.esc_attr($option).'">'.esc_html($option).'</option>'; | |
| 305 | + if($settings['booking_hide_count_childs_field'] != 'yes' && !empty($calendar->is_children_acceptable)) { | |
| 306 | + $output .='<div class="elementinvader_addons_for_elementor_f_group elementinvader_addons_for_elementor_f_group_el_guests" style="width: 50%;-webkit-flex: 0 0 50%;flex: 0 0 50%;">'; | |
| 307 | + $output .='<select name="guests_number_childs" id="guests_number_childs" type="select" class="elementinvader_addons_for_elementor_f_field" value="'.wmvc_show_data('guests_number', $_GET).'">'; | |
| 308 | + $output .= '<option value="">'.esc_html__('Childs','wpdirectorykit').'</option>'; | |
| 309 | + foreach ($options as $key => $option){ | |
| 310 | + if(!next($options)) { | |
| 311 | + $output .= '<option value="'.esc_attr($option).'+">'.esc_html($option).'+</option>'; | |
| 312 | + } else { | |
| 313 | + $output .= '<option value="'.esc_attr($option).'">'.esc_html($option).'</option>'; | |
| 314 | + } | |
| 287 | 315 | } |
| 288 | - } | |
| 289 | - $output .='</select> | |
| 290 | - </div>'; | |
| 316 | + $output .='</select> | |
| 317 | + </div>'; | |
| 318 | + } | |
| 319 | + | |
| 291 | 320 | $this->content ['wlisting_fields'] .= $output; |
| 292 | 321 | } |
| 293 | 322 | |
| 294 | 323 | |
| @@ -336,9 +365,9 @@ | ||
| 336 | 365 | |
| 337 | 366 | foreach ($calendar_fees as $fee) { |
| 338 | 367 | if(!wmvc_show_data('is_activated', $fee, false,TRUE,TRUE)) continue; |
| 339 | 368 | |
| 340 | - $field = str_replace(' ','_',strtolower(esc_html(wmvc_show_data('title', $fee,'-',TRUE,TRUE)))); | |
| 369 | + $field = wdk_generate_slug(strtolower(esc_html(wmvc_show_data('title', $fee,'-',TRUE,TRUE)))); | |
| 341 | 370 | |
| 342 | 371 | $readonly = ''; |
| 343 | 372 | if(wmvc_show_data('is_required', $fee, false,TRUE,TRUE)) { |
| 344 | 373 | $readonly = 'readonly disabled'; |
| @@ -354,23 +383,13 @@ | ||
| 354 | 383 | } |
| 355 | 384 | } |
| 356 | 385 | } |
| 357 | 386 | |
| 358 | - if($settings['booking_hide_if_сhildrens_allowed_field'] != 'yes') { | |
| 359 | - $this->content ['wlisting_fields'] .='<div class="elementinvader_addons_for_elementor_f_group checkbox elementinvader_addons_for_elementor_f_group_el_сhildrens" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> | |
| 360 | - <label for="сhildrens_allowed"> | |
| 361 | - <input name="сhildrens_allowed" id="сhildrens_allowed" type="checkbox" class="elementinvader_addons_for_elementor_f_field_checkbox" value="yes" placeholder="'.esc_attr__('Childrens allowed ','wpdirectorykit').'" > | |
| 362 | - '.esc_html__('Childrens ','wpdirectorykit').' | |
| 363 | - </label> | |
| 364 | - </div>'; | |
| 365 | - } | |
| 366 | - | |
| 367 | - | |
| 368 | - if ($settings['booking_hide_if_pets_allowed_field'] != 'yes') { | |
| 387 | + if ($settings['booking_hide_if_pets_allowed_field'] != 'yes' && wmvc_show_data('is_pets_acceptable',$calendar, false)) { | |
| 369 | 388 | $this->content ['wlisting_fields'] .='<div class="elementinvader_addons_for_elementor_f_group checkbox elementinvader_addons_for_elementor_f_group_el_pets" style="width: 100%;-webkit-flex: 0 0 100%;flex: 0 0 100%;"> |
| 370 | 389 | <label for="pets_allowed"> |
| 371 | - <input name="pets_allowed" id="pets_allowed" type="checkbox" class="elementinvader_addons_for_elementor_f_field_checkbox" value="yes" placeholder="'.esc_attr__('Pets allowed ', 'wpdirectorykit').'" > | |
| 372 | - '.esc_html__('Pets ', 'wpdirectorykit').' | |
| 390 | + <input name="pets_allowed" id="pets_allowed" type="checkbox" class="elementinvader_addons_for_elementor_f_field_checkbox" value="yes" placeholder="'.esc_attr__('Pets allowed', 'wpdirectorykit').'" > | |
| 391 | + '.esc_html__('Pets', 'wpdirectorykit').' | |
| 373 | 392 | </label> |
| 374 | 393 | </div>'; |
| 375 | 394 | } |
| 376 | 395 | |