Advertisement
Guest User

Untitled

a guest
Jun 28th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.56 KB | None | 0 0
  1. remove_action ('wp_travel_booking_princing_options_list', 'wp_travel_booking_tab_pricing_options_list');
  2.  
  3. function wp_travel_booking_tab_pricing_options_list_placeholder_modification( $trip_data = null ) {
  4.  
  5. if ( '' == $trip_data ) {
  6. return;
  7. }
  8. global $wp_travel_itinerary;
  9.  
  10. if ( is_array( $trip_data ) ) {
  11. global $post;
  12. $trip_id = $post->ID;
  13. } elseif ( is_numeric( $trip_data ) ) {
  14. $trip_id = $trip_data;
  15. }
  16.  
  17. $js_date_format = wp_travel_date_format_php_to_js();
  18.  
  19. $settings = wp_travel_get_settings();
  20. $form = new WP_Travel_FW_Form();
  21. $form_field = new WP_Travel_FW_Field();
  22.  
  23. $fixed_departure = get_post_meta( $trip_id, 'wp_travel_fixed_departure', true );
  24. $show_end_date = wp_travel_booking_show_end_date();
  25. $currency_symbol = wp_travel_get_currency_symbol();
  26.  
  27. $trip_start_date = get_post_meta( $trip_id, 'wp_travel_start_date', true );
  28. $trip_end_date = get_post_meta( $trip_id, 'wp_travel_end_date', true );
  29.  
  30. $trip_price = wp_travel_get_trip_price( $trip_id );
  31. $regular_price = $trip_price;
  32.  
  33. $enable_sale = wp_travel_is_enable_sale( $trip_id );
  34. if ( $enable_sale ) {
  35. $trip_price = wp_travel_get_trip_sale_price( $trip_id );
  36. }
  37. $price_per_text = wp_travel_get_price_per_text( $trip_id );
  38.  
  39. $trip_duration = get_post_meta( $trip_id, 'wp_travel_trip_duration', true );
  40. $trip_duration = ( $trip_duration ) ? $trip_duration : 0;
  41. $trip_duration_night = get_post_meta( $trip_id, 'wp_travel_trip_duration_night', true );
  42. $trip_duration_night = ( $trip_duration_night ) ? $trip_duration_night : 0;
  43.  
  44. $available_pax = false;
  45. $booked_pax = false;
  46. $pax_limit = false;
  47. $general_sold_out = false;
  48.  
  49. $status_col = apply_filters( 'wp_travel_inventory_enable_status_column', false, $trip_id );
  50.  
  51. $status_msg = get_post_meta( $trip_id, 'wp_travel_inventory_status_message_format', true );
  52. $sold_out_btn_rep_msg = apply_filters( 'wp_travel_inventory_sold_out_button', '', $trip_id );
  53.  
  54. // Multiple Pricing. [ including single and multiple date ].
  55. if ( is_array( $trip_data ) ) {
  56. if ( empty( $trip_data ) ) {
  57. return;
  58. }
  59. $trip_extras_class = new Wp_Travel_Extras_Frontend();
  60. ?>
  61. <div id="wp-travel-date-price" class="detail-content">
  62. <div class="availabily-wrapper">
  63. <ul class="availabily-list additional-col">
  64. <li class="availabily-heading clearfix">
  65. <div class="date-from">
  66. <?php echo esc_html__( 'Pricing Name', 'wp-travel' ); ?>
  67. </div>
  68. <div class="date-from">
  69. <?php echo esc_html__( 'Start', 'wp-travel' ); ?>
  70. </div>
  71. <div class="group-size">
  72. <?php echo esc_html__( 'Group (min-max)', 'wp-travel' ); ?>
  73. </div>
  74. <?php if ( $status_col ) : ?>
  75. <div class="seats-left">
  76. <?php echo esc_html__( 'Seats Left', 'wp-travel' ); ?>
  77. </div>
  78. <?php endif; ?>
  79. <div class="no-of-pax">
  80. <?php echo esc_html__( 'Pax', 'wp-travel' ); ?>
  81. </div>
  82. <div class="price">
  83. <?php echo esc_html__( 'Price', 'wp-travel' ); ?>
  84. </div>
  85. <div class="action">
  86. &nbsp;
  87. </div>
  88. </li>
  89. <?php
  90. foreach ( $trip_data as $price_key => $pricing ) :
  91. // Set Vars.
  92. $pricing_name = isset( $pricing['pricing_name'] ) ? $pricing['pricing_name'] : '';
  93. $price_key = isset( $pricing['price_key'] ) ? $pricing['price_key'] : '';
  94. $pricing_type = isset( $pricing['type'] ) ? $pricing['type'] : '';
  95. $pricing_custom_label = isset( $pricing['custom_label'] ) ? $pricing['custom_label'] : '';
  96. $pricing_option_price = isset( $pricing['price'] ) ? $pricing['price'] : '';
  97. $pricing_sale_enabled = isset( $pricing['enable_sale'] ) ? $pricing['enable_sale'] : '';
  98. $pricing_sale_price = isset( $pricing['sale_price'] ) ? $pricing['sale_price'] : '';
  99. $pricing_min_pax = isset( $pricing['min_pax'] ) ? $pricing['min_pax'] : '';
  100. $pricing_max_pax = isset( $pricing['max_pax'] ) ? $pricing['max_pax'] : '';
  101.  
  102. $regular_price = $pricing_option_price;
  103. $trip_price = $pricing_option_price;
  104. if ( 'yes' === $pricing_sale_enabled ) {
  105. $trip_price = $pricing_sale_price;
  106. }
  107.  
  108. $available_dates = wp_travel_get_trip_available_dates( $trip_id, $price_key ); // No need to pass date
  109.  
  110. $pricing_sold_out = false;
  111.  
  112. $inventory_data = array(
  113. 'status_message' => __( 'N/A', 'wp-travel' ),
  114. 'sold_out' => false,
  115. 'available_pax' => 0,
  116. 'booked_pax' => 0,
  117. 'pax_limit' => 0,
  118. 'min_pax' => $pricing_min_pax,
  119. 'max_pax' => $pricing_max_pax,
  120. );
  121. $pricing_default_types = wp_travel_get_pricing_variation_options();
  122.  
  123. if ( is_array( $available_dates ) && count( $available_dates ) > 0 ) { // multiple available dates
  124. foreach ( $available_dates as $available_date ) {
  125. // echo $available_date;
  126. $inventory_data = apply_filters( 'wp_travel_inventory_data', $inventory_data, $trip_id, $price_key, $available_date ); // Need to pass inventory date to get availability as per specific date.
  127.  
  128. $pricing_status_msg = $inventory_data['status_message'];
  129. $pricing_sold_out = $inventory_data['sold_out'];
  130. $available_pax = $inventory_data['available_pax'];
  131. $booked_pax = $inventory_data['booked_pax'];
  132. $pax_limit = $inventory_data['pax_limit'];
  133. $min_pax = $inventory_data['min_pax'];
  134. $max_pax = $inventory_data['max_pax'];
  135.  
  136. if ( class_exists( 'WP_Travel_Util_Inventory' ) ) {
  137. $inventory = new WP_Travel_Util_Inventory();
  138. if ( $inventory->is_inventory_enabled( $trip_id ) && $available_pax ) {
  139. $pricing_max_pax = $available_pax;
  140. }
  141. }
  142. $max_attr = 'max=' . $pricing_max_pax;
  143. $parent_id = sprintf( 'pricing-%s-%s', esc_attr( $price_key ), $available_date );
  144.  
  145. $unavailable_class = '';
  146. $availability = wp_travel_trip_availability( $trip_id, $price_key, $available_date, $pricing_sold_out );
  147. if ( ! $availability ) {
  148. $unavailable_class = 'pricing_unavailable';
  149. }
  150.  
  151. $pricing_type_label = ( 'custom' === $pricing_type ) ? $pricing_custom_label : $pricing_default_types[ $pricing_type ];
  152.  
  153. $cart_url = add_query_arg( 'trip_id', get_the_ID(), wp_travel_get_cart_url() );
  154. if ( 'yes' !== $fixed_departure ) :
  155. $cart_url = add_query_arg( 'trip_duration', $trip_duration, $cart_url );
  156. endif;
  157. $cart_url = add_query_arg( 'price_key', $price_key, $cart_url );
  158. ?>
  159. <li class="availabily-content clearfix <?php echo esc_attr( $unavailable_class ); ?>">
  160. <form action="<?php echo esc_url( $cart_url ); ?>" id="<?php echo esc_attr( $parent_id ); ?>" class="wp-travel-add-to-cart-form">
  161. <div class="date-from">
  162. <span class="availabily-heading-label"><?php echo esc_html__( 'Pricing Name:', 'wp-travel' ); ?></span>
  163. <span> <?php echo esc_html( $pricing_name ); ?> </span>
  164. </div>
  165. <div class="date-from">
  166. <span class="availabily-heading-label"><?php echo esc_html__( 'Start:', 'wp-travel' ); ?></span>
  167. <span> <?php echo esc_html( wp_travel_format_date( $available_date ) ); ?> </span>
  168. </div>
  169. <div class="group-size">
  170. <span class="availabily-heading-label"><?php echo esc_html__( 'Group (Min-Max):', 'wp-travel' ); ?></span>
  171. <span>
  172. <?php
  173. $min = ! empty( $pricing_min_pax ) ? esc_html( $pricing_min_pax . __( ' pax', 'wp-travel' ) ) : esc_html__( 'No size limit', 'wp-travel' );
  174. $max = ! empty( $pricing_max_pax ) ? esc_html( $pricing_max_pax . __( ' pax', 'wp-travel' ) ) : esc_html__( 'No size limit', 'wp-travel' );
  175. echo sprintf( '%s - %s', $min, $max );
  176. ?>
  177. </span>
  178. </div>
  179. <?php
  180. if ( $status_col ) :
  181.  
  182. if ( $pricing_sold_out ) :
  183. ?>
  184. <div class="status">
  185. <span class="availabily-heading-label"><?php echo esc_html__( 'Status:', 'wp-travel' ); ?></span>
  186. <span><?php echo esc_html__( 'SOLD OUT', 'wp-travel' ); ?></span>
  187. </div>
  188. <?php else : ?>
  189. <div class="status">
  190. <span class="availabily-heading-label"><?php echo esc_html__( 'Status:', 'wp-travel' ); ?></span>
  191. <span><?php echo esc_html( $pricing_status_msg ); ?></span>
  192.  
  193. </div>
  194. <?php
  195. endif;
  196. endif;
  197. $max_attr = '';
  198. $min_attr = 'min=1';
  199. if ( '' !== $pricing_max_pax ) {
  200.  
  201. $max_attr = 'max=' . $pricing_max_pax;
  202. }
  203. if ( '' !== $pricing_min_pax ) {
  204. $min_attr = 'min=' . $pricing_min_pax;
  205. }
  206. ?>
  207.  
  208. <div class="no-of-pax">
  209. <input name="pax" type="number" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" <?php echo esc_attr( $min_attr ); ?> <?php echo esc_attr( $max_attr ); ?> placeholder="<?php echo esc_attr__( 'Change your text here', 'wp-travel' ); ?>" required data-parsley-trigger="change">
  210. </div>
  211. <div class="price">
  212. <span class="availabily-heading-label"><?php echo esc_html__( 'price:', 'wp-travel' ); ?></span>
  213. <?php if ( $pricing_option_price ) : ?>
  214.  
  215. <?php if ( 'yes' === $pricing_sale_enabled ) : ?>
  216. <del>
  217. <span><?php echo wp_travel_get_formated_price_currency( $regular_price, true ); ?></span>
  218. </del>
  219. <?php endif; ?>
  220. <span class="person-count">
  221. <ins>
  222. <span><?php echo wp_travel_get_formated_price_currency( $trip_price ); ?></span>
  223. </ins>/<?php echo esc_html( $pricing_type_label ); ?>
  224. </span>
  225. <?php endif; ?>
  226. </div>
  227. <div class="action">
  228.  
  229. <?php if ( $pricing_sold_out ) : ?>
  230.  
  231. <p class="wp-travel-sold-out"><?php echo $sold_out_btn_rep_msg; ?></p>
  232.  
  233. <?php else :
  234. // $trip_extras_class = new Wp_Travel_Extras_Frontend();
  235. if ( $trip_extras_class->has_trip_extras( $trip_id, $price_key ) ) { ?>
  236. <a href="#0" class="btn btn-primary btn-sm btn-inverse show-booking-row"><?php echo esc_html__( 'Select', 'wp-travel' ); ?></a>
  237. <?php
  238. } else { ?>
  239. <input type="submit" value="<?php echo esc_html__( 'Book now', 'wp-travel' ); ?>" class="btn add-to-cart-btn btn-primary btn-sm btn-inverse" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" >
  240. <?php
  241. }
  242. // @since 1.9.3 To display group discount pricing lists.
  243. do_action( 'wp_travel_booking_after_select_button', $trip_id, $price_key );
  244. ?>
  245. <?php endif; ?>
  246. <input type="hidden" name="trip_date" value="<?php echo esc_attr( $available_date ); ?>" >
  247. <input type="hidden" name="trip_id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
  248. <input type="hidden" name="price_key" value="<?php echo esc_attr( $price_key ); ?>" />
  249. </div>
  250. <?php if ( $availability ) : // Remove Book now if trip is soldout. ?>
  251. <div class="wp-travel-booking-row">
  252. <?php
  253. /**
  254. * Support For WP Travel Tour Extras Plugin.
  255. *
  256. * @since 1.5.8
  257. */
  258. do_action( 'wp_travel_trip_extras', $price_key, $available_date );
  259. ?>
  260. <div class="wp-travel-calender-aside">
  261. <div class="add-to-cart">
  262.  
  263. <?php
  264. if ( 'yes' !== $fixed_departure ) :
  265. ?>
  266. <input type="hidden" name="trip_duration" value="<?php echo esc_attr( $trip_duration ); ?>" />
  267. <?php
  268. endif;
  269. ?>
  270. <input type="submit" value="<?php echo esc_html__( 'Book now', 'wp-travel' ); ?>" class="btn add-to-cart-btn btn-primary btn-sm btn-inverse" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" >
  271.  
  272. </div>
  273. </div>
  274. </div>
  275. <?php endif; ?>
  276. </form>
  277. </li>
  278. <?php
  279. }
  280. } else { // Single Date.
  281. $inventory_data = apply_filters( 'wp_travel_inventory_data', $inventory_data, $trip_id, $price_key ); // Need to pass inventory date to get availability as per specific date.
  282.  
  283. $pricing_status_msg = $inventory_data['status_message'];
  284. $pricing_sold_out = $inventory_data['sold_out'];
  285. $available_pax = $inventory_data['available_pax'];
  286. $booked_pax = $inventory_data['booked_pax'];
  287. $pax_limit = $inventory_data['pax_limit'];
  288. $min_pax = $inventory_data['min_pax'];
  289. $max_pax = $inventory_data['max_pax'];
  290.  
  291. $pricing_default_types = wp_travel_get_pricing_variation_options();
  292.  
  293. $pricing_type_label = ( 'custom' === $pricing_type ) ? $pricing_custom_label : $pricing_default_types[ $pricing_type ];
  294.  
  295. if ( class_exists( 'WP_Travel_Util_Inventory' ) ) {
  296. $inventory = new WP_Travel_Util_Inventory();
  297. if ( $inventory->is_inventory_enabled( $trip_id ) && $available_pax ) {
  298. $pricing_max_pax = $available_pax;
  299. }
  300. }
  301. $max_attr = 'max=' . $pricing_max_pax;
  302. $parent_id = sprintf( 'pricing-%s', $price_key );
  303.  
  304. $cart_url = add_query_arg( 'trip_id', get_the_ID(), wp_travel_get_cart_url() );
  305. if ( 'yes' !== $fixed_departure ) :
  306. $cart_url = add_query_arg( 'trip_duration', $trip_duration, $cart_url );
  307. endif;
  308. $cart_url = add_query_arg( 'price_key', $price_key, $cart_url );
  309. ?>
  310. <li id="<?php echo esc_attr( $parent_id ); ?>" class="availabily-content clearfix">
  311. <form action="<?php echo esc_url( $cart_url ); ?>" id="<?php echo esc_attr( $parent_id ); ?>" class="wp-travel-add-to-cart-form">
  312.  
  313. <div class="date-from">
  314. <span class="availabily-heading-label"><?php echo esc_html__( 'Pricing Name:', 'wp-travel' ); ?></span> <span><?php echo esc_html( $pricing_name ); ?></span>
  315. </div>
  316. <div class="date-from">
  317. <span class="availabily-heading-label"><?php echo esc_html__( 'Start:', 'wp-travel' ); ?></span>
  318. <div class="wp-travel-calender-column1 no-padding ">
  319.  
  320. <label for=""><?php echo esc_html__( 'Select a Date:', 'wp-travel' ); ?></label>
  321. <input data-date-format="<?php echo esc_attr( $js_date_format ); ?>" name="trip_date" type="text" data-available-dates="<?php echo ( $available_dates ) ? esc_attr( wp_json_encode( $available_dates ) ) : ''; ?>" readonly class="wp-travel-pricing-dates" required data-parsley-trigger="change" data-parsley-required-message="<?php echo esc_attr__( 'Please Select a Date', 'wp-travel' ); ?>">
  322.  
  323. </div>
  324. </div>
  325. <div class="status">
  326. <span class="availabily-heading-label"><?php echo esc_html__( 'Group (Min/Max):', 'wp-travel' ); ?></span>
  327. <span>
  328. <?php
  329. $min = ! empty( $pricing_min_pax ) ? esc_html( $pricing_min_pax . __( ' pax', 'wp-travel' ) ) : esc_html__( 'No size limit', 'wp-travel' );
  330. $max = ! empty( $pricing_max_pax ) ? esc_html( $pricing_max_pax . __( ' pax', 'wp-travel' ) ) : esc_html__( 'No size limit', 'wp-travel' );
  331. echo sprintf( '%s / %s', $min, $max );
  332. ?>
  333. </span>
  334. </div>
  335.  
  336. <?php
  337. if ( $status_col ) :
  338.  
  339. if ( $pricing_sold_out ) :
  340. ?>
  341. <div class="status">
  342. <span class="availabily-heading-label"><?php echo esc_html__( 'Seats Left:', 'wp-travel' ); ?></span>
  343. <span><?php echo esc_html__( 'SOLD OUT', 'wp-travel' ); ?></span>
  344. </div>
  345. <?php else : ?>
  346. <div class="status">
  347. <span class="availabily-heading-label"><?php echo esc_html__( 'Seats Left:', 'wp-travel' ); ?></span>
  348. <span><?php echo esc_html( $pricing_status_msg ); ?></span>
  349. </div>
  350. <?php
  351. endif;
  352. endif;
  353. $max_attr = '';
  354. $min_attr = 'min=1';
  355. if ( '' !== $pricing_max_pax ) {
  356.  
  357. $max_attr = 'max=' . $pricing_max_pax;
  358. }
  359. if ( '' !== $pricing_min_pax ) {
  360. $min_attr = 'min=' . $pricing_min_pax;
  361. }
  362. ?>
  363. <div class="no-of-pax">
  364. <input name="pax" type="number" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" <?php echo esc_attr( $min_attr ); ?> <?php echo esc_attr( $max_attr ); ?> placeholder="<?php echo esc_attr__( 'Change your text here', 'wp-travel' ); ?>" required data-parsley-trigger="change">
  365. </div>
  366. <div class="price">
  367. <span class="availabily-heading-label"><?php echo esc_html__( 'price:', 'wp-travel' ); ?></span>
  368. <?php if ( $pricing_option_price ) : ?>
  369.  
  370. <?php if ( 'yes' === $pricing_sale_enabled ) : ?>
  371. <del>
  372. <span><?php echo wp_travel_get_formated_price_currency( $regular_price, true ); ?></span>
  373. </del>
  374. <?php endif; ?>
  375. <span class="person-count">
  376. <ins>
  377. <span><?php echo wp_travel_get_formated_price_currency( $trip_price ); ?></span>
  378. </ins>/<?php echo esc_html( $pricing_type_label ); ?>
  379. </span>
  380. <?php endif; ?>
  381. </div>
  382. <div class="action">
  383.  
  384. <?php if ( $pricing_sold_out ) : ?>
  385.  
  386. <p class="wp-travel-sold-out"><?php echo $sold_out_btn_rep_msg; ?></p>
  387.  
  388. <?php else :
  389. if ( $trip_extras_class->has_trip_extras( $trip_id, $price_key ) ) {
  390. ?>
  391. <a href="#0" class="btn btn-primary btn-sm btn-inverse show-booking-row"><?php echo esc_html__( 'Select', 'wp-travel' ); ?></a>
  392. <?php
  393. // @since 1.9.3 To display group discount pricing lists.
  394. do_action( 'wp_travel_booking_after_select_button', $trip_id, $price_key );
  395. } else {
  396. ?>
  397. <input type="submit" value="<?php echo esc_html__( 'Book now', 'wp-travel' ); ?>" class="btn add-to-cart-btn btn-primary btn-sm btn-inverse" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" >
  398.  
  399. <?php
  400. }
  401. ?>
  402. <?php endif; ?>
  403. <input type="hidden" name="trip_id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
  404. <input type="hidden" name="price_key" value="<?php echo esc_attr( $price_key ); ?>" />
  405. <?php
  406. if ( 'yes' !== $fixed_departure ) : ?>
  407. <input type="hidden" name="trip_duration" value="<?php echo esc_attr( $trip_duration ); ?>" />
  408. <?php endif; ?>
  409. </div>
  410. <?php if ( $trip_extras_class->has_trip_extras( $trip_id, $price_key ) ) : ?>
  411. <div class="wp-travel-booking-row">
  412. <?php
  413. /**
  414. * Support For WP Travel Tour Extras Plugin.
  415. *
  416. * @since 1.5.8
  417. */
  418. do_action( 'wp_travel_trip_extras', $price_key );
  419. ?>
  420. <div class="wp-travel-calender-aside">
  421. <div class="add-to-cart">
  422.  
  423. <input type="submit" value="<?php echo esc_html__( 'Book now', 'wp-travel' ); ?>" class="btn add-to-cart-btn btn-primary btn-sm btn-inverse" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" >
  424.  
  425. </div>
  426. </div>
  427. </div>
  428. <?php endif; ?>
  429. </form>
  430. </li>
  431. <?php
  432. }
  433. endforeach;
  434. ?>
  435. </ul>
  436. </div>
  437. </div>
  438. <?php
  439.  
  440. } elseif ( is_numeric( $trip_data ) ) { // Single Pricing
  441. $inventory_data = array(
  442. 'status_message' => __( 'N/A', 'wp-travel' ),
  443. 'sold_out' => false,
  444. 'available_pax' => 0,
  445. 'booked_pax' => 0,
  446. 'pax_limit' => 0,
  447. 'min_pax' => '',
  448. 'max_pax' => 0,
  449. );
  450.  
  451. $inventory_data = apply_filters( 'wp_travel_inventory_data', $inventory_data, $trip_id, '' );
  452.  
  453. $pricing_status_msg = $inventory_data['status_message'];
  454. $pricing_sold_out = $inventory_data['sold_out'];
  455. $available_pax = $inventory_data['available_pax'];
  456. $booked_pax = $inventory_data['booked_pax'];
  457. $pax_limit = $inventory_data['pax_limit'];
  458. $min_pax = $inventory_data['min_pax'];
  459. $max_pax = $inventory_data['max_pax'];
  460.  
  461. $cart_url = add_query_arg( 'trip_id', get_the_ID(), wp_travel_get_cart_url() );
  462. if ( 'yes' !== $fixed_departure ) :
  463. $cart_url = add_query_arg( 'trip_duration', $trip_duration, $cart_url );
  464. endif;
  465. $parent_id = 'trip-duration-content';
  466. ?>
  467. <div id="wp-travel-date-price" class="detail-content">
  468. <div class="availabily-wrapper">
  469. <ul class="availabily-list <?php echo 'yes' === $fixed_departure ? 'additional-col' : ''; ?>">
  470. <li class="availabily-heading clearfix">
  471. <div class="date-from">
  472. <?php echo esc_html__( 'Start', 'wp-travel' ); ?>
  473. </div>
  474. <?php if ( $show_end_date ) : ?>
  475. <div class="date-to">
  476. <?php echo esc_html__( 'End', 'wp-travel' ); ?>
  477. </div>
  478. <?php endif; ?>
  479. <div class="status">
  480. <?php echo esc_html__( 'Group Size', 'wp-travel' ); ?>
  481. </div>
  482. <?php if ( $status_col ) : ?>
  483. <div class="status">
  484. <?php echo esc_html__( 'Status', 'wp-travel' ); ?>
  485. </div>
  486. <?php endif; ?>
  487. <div class="price">
  488. <?php echo esc_html__( 'Price', 'wp-travel' ); ?>
  489. </div>
  490. <div class="action">
  491. &nbsp;
  492. </div>
  493. </li>
  494. <li class="availabily-content clearfix" >
  495. <form action="<?php echo esc_url( $cart_url ); ?>" id="<?php echo esc_attr( $parent_id ); ?>" class="wp-travel-add-to-cart-form">
  496. <?php if ( 'yes' == $fixed_departure ) : ?>
  497. <div class="date-from">
  498. <span class="availabily-heading-label"><?php echo esc_html__( 'start:', 'wp-travel' ); ?></span>
  499. <?php echo esc_html( date_i18n( 'l', strtotime( $trip_start_date ) ) ); ?>
  500. <?php $date_format = get_option( 'date_format' ); ?>
  501. <?php if ( ! $date_format ) : ?>
  502. <?php $date_format = 'jS M, Y'; ?>
  503. <?php endif; ?>
  504. <span><?php echo esc_html( date_i18n( $date_format, strtotime( $trip_start_date ) ) ); ?></span>
  505. <input type="hidden" name="trip_date" value="<?php echo esc_attr( $trip_start_date ); ?>">
  506. </div>
  507. <?php
  508. if ( $show_end_date ) :
  509. ?>
  510. <div class="date-to">
  511. <?php if ( '' !== $trip_end_date ) : ?>
  512. <span class="availabily-heading-label"><?php echo esc_html__( 'end:', 'wp-travel' ); ?></span>
  513. <?php echo esc_html( date_i18n( 'l', strtotime( $trip_end_date ) ) ); ?>
  514. <span><?php echo esc_html( date_i18n( $date_format, strtotime( $trip_end_date ) ) ); ?></span>
  515. <input type="hidden" name="trip_departure_date" value="<?php echo esc_attr( $trip_end_date ); ?>">
  516. <?php else : ?>
  517. <?php esc_html_e( '-', 'wp-travel' ); ?>
  518. <?php endif; ?>
  519. </div>
  520. <?php endif; ?>
  521. <?php else : ?>
  522. <div class="date-from">
  523. <span class="availabily-heading-label"><?php echo esc_html__( 'start:', 'wp-travel' ); ?></span>
  524. <?php
  525. $total_days = 0;
  526. if ( $trip_duration > 0 || $trip_duration_night > 0 ) {
  527. $days = $trip_duration > $trip_duration_night ? $trip_duration : $trip_duration_night;
  528. $days--; // As we need to exclude current selected date.
  529. $total_days = $days ? $days : $total_days;
  530. }
  531. $start_field = array(
  532. 'label' => esc_html__( 'start', 'wp-travel' ),
  533. 'type' => 'date',
  534. 'name' => 'trip_date',
  535. 'placeholder' => esc_html__( 'Arrival date', 'wp-travel' ),
  536. 'class' => 'wp-travel-pricing-days-night',
  537. 'validations' => array(
  538. 'required' => true,
  539. ),
  540. 'attributes' => array(
  541. 'data-parsley-trigger' => 'change',
  542. 'data-parsley-required-message' => esc_attr__( 'Please Select a Date', 'wp-travel' ),
  543. 'data-totaldays' => $total_days,
  544. ),
  545. 'wrapper_class' => 'date-from',
  546. );
  547. $form_field->init()->render_input( $start_field );
  548. ?>
  549. </div>
  550. <div class="date-to">
  551. <?php
  552. $end_field = array(
  553. 'label' => esc_html__( 'End', 'wp-travel' ),
  554. 'type' => 'date',
  555. 'name' => 'trip_departure_date',
  556. 'placeholder' => esc_html__( 'Departure date', 'wp-travel' ),
  557. );
  558. $end_field = wp_parse_args( $end_field, $start_field );
  559. $form_field->init()->render_input( $end_field );
  560. ?>
  561. </div>
  562. <?php endif; ?>
  563. <div class="status">
  564. <span class="availabily-heading-label"><?php echo esc_html__( 'Group Size:', 'wp-travel' ); ?></span>
  565. <span><?php echo esc_html( wp_travel_get_group_size() ); ?></span>
  566. </div>
  567. <?php if ( $status_col ) : ?>
  568.  
  569. <div class="status">
  570. <span class="availabily-heading-label"><?php echo esc_html__( 'Status:', 'wp-travel' ); ?></span>
  571. <span><?php echo esc_html( $pricing_status_msg ); ?></span>
  572. </div>
  573.  
  574. <?php endif; ?>
  575. <?php
  576. if ( class_exists( 'WP_Travel_Util_Inventory' ) && ! $trip_price ) :
  577. // display price unavailable text
  578. $no_price_text = isset( $settings['price_unavailable_text'] ) && '' !== $settings['price_unavailable_text'] ? $settings['price_unavailable_text'] : '';
  579. echo '<div class="price"><strong>' . esc_html( $no_price_text ) . '</strong></div>';
  580. else :
  581. ?>
  582. <div class="price">
  583. <span class="availabily-heading-label"><?php echo esc_html__( 'price:', 'wp-travel' ); ?></span>
  584. <?php if ( $enable_sale ) : ?>
  585. <del>
  586. <span><?php echo wp_travel_get_formated_price_currency( $regular_price, true ); ?></span>
  587. </del>
  588. <?php endif; ?>
  589. <span class="person-count">
  590. <ins>
  591. <span><?php echo wp_travel_get_formated_price_currency( $trip_price ); ?></span>
  592. </ins>/<?php echo esc_html( $price_per_text ); ?>
  593. </span>
  594. </div>
  595. <?php endif; ?>
  596. <div class="action">
  597. <?php
  598. // if ( $inventory_enabled && $general_sold_out ) :
  599. if ( $general_sold_out ) :
  600. ?>
  601.  
  602. <p class="wp-travel-sold-out"><?php echo $sold_out_btn_rep_msg; ?></p>
  603.  
  604. <?php else : ?>
  605. <?php $pax = 1; ?>
  606.  
  607. <input type="hidden" name="trip_id" value="<?php echo esc_attr( $trip_id ); ?>">
  608. <input type="hidden" name="pax" value="<?php echo esc_attr( $pax ); ?>">
  609. <input type="hidden" name="trip_duration" value="<?php echo esc_attr( $trip_duration ); ?>">
  610. <input type="hidden" name="trip_duration_night" value="<?php echo esc_attr( $trip_duration_night ); ?>">
  611.  
  612. <input type="submit" value="<?php echo esc_html__( 'Book now', 'wp-travel' ); ?>" class="btn add-to-cart-btn btn-primary btn-sm btn-inverse" data-parent-id="<?php echo esc_attr( $parent_id ); ?>" >
  613.  
  614. <?php endif; ?>
  615. </div>
  616. <div class="wp-travel-booking-row-single-price">
  617. <?php do_action( 'wp_travel_trip_extras' ); ?>
  618. </div>
  619. </form>
  620. </li>
  621. </ul>
  622. </div>
  623. </div>
  624. <?php
  625. }
  626.  
  627. }
  628. add_action( 'wp_travel_booking_princing_options_list', 'wp_travel_booking_tab_pricing_options_list_placeholder_modification' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement