2020-05-24 04:17:41 -04:00
< ? php
if ( ! defined ( 'ABSPATH' )) {
die ;
} // Cannot access pages directly.
2020-01-22 07:15:24 -05:00
2021-09-03 06:25:05 -04:00
add_action ( 'mep_add_to_cart' , 'mep_get_event_reg_btn' , 10 , 2 );
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_get_event_reg_btn' )) {
// Get Event Registration Button
2021-09-03 06:25:05 -04:00
function mep_get_event_reg_btn ( $event_id = '' , $params = [])
2021-09-20 01:52:52 -04:00
{
2020-05-24 04:17:41 -04:00
global $post , $event_meta ;
2021-09-20 01:52:52 -04:00
$event_id = mep_get_default_lang_event_id ( $event_id );
2022-06-27 00:31:32 -04:00
$new_registration_system_sp = get_post_meta ( $event_id , 'mpwemasp_seat_plan_system' , true ) ? get_post_meta ( $event_id , 'mpwemasp_seat_plan_system' , true ) : 'off' ;
$seat_plan = get_post_meta ( $event_id , 'mepsp_event_seat_plan_info' , true ) ? get_post_meta ( $event_id , 'mepsp_event_seat_plan_info' , true ) : [];
$seat_plan_visible = get_post_meta ( $event_id , 'mp_event_seat_plan_visible' , true ) ? get_post_meta ( $event_id , 'mp_event_seat_plan_visible' , true ) : '1' ;
// if(class_exists('MP_ESP_Frontend') && sizeof($seat_plan) > 0 && $seat_plan_visible ==2 &&$new_registration_system_sp=='on'){
// do_action('mpwem_new_registration_system_sp',$event_id);
// }else{
2021-09-20 01:52:52 -04:00
$saved_user_role = get_post_meta ( $event_id , 'mep_member_only_user_role' , true ) ? get_post_meta ( $event_id , 'mep_member_only_user_role' , true ) : [];
2022-06-27 00:31:32 -04:00
$event_member_type = get_post_meta ( $event_id , 'mep_member_only_event' , true ) ? get_post_meta ( $event_id , 'mep_member_only_event' , true ) : 'for_all' ;
2021-02-25 06:55:25 -05:00
2021-10-31 07:01:04 -04:00
$cart_btn_label = array_key_exists ( 'cart-btn-label' , $params ) ? esc_html ( $params [ 'cart-btn-label' ]) : mep_get_label ( $event_id , 'mep_cart_btn_text' , esc_html__ ( 'Register This Event' , 'mage-eventpress' ));
$ticket_type_label = array_key_exists ( 'ticket-label' , $params ) ? esc_html ( $params [ 'ticket-label' ]) : mep_get_label ( $event_id , 'mep_event_ticket_type_text' , esc_html__ ( 'Ticket Type:' , 'mage-eventpress' ));
$extra_service_label = array_key_exists ( 'extra-service-label' , $params ) ? esc_html ( $params [ 'extra-service-label' ]) : mep_get_label ( $event_id , 'mep_event_extra_service_text' , esc_html__ ( 'Extra Service:' , 'mage-eventpress' ));
$select_date_label = array_key_exists ( 'select-date-label' , $params ) ? esc_html ( $params [ 'select-date-label' ]) : mep_get_option ( 'mep_event_rec_select_event_date_text' , 'label_setting_sec' , esc_html__ ( 'Select Event Date:' , 'mage-eventpress' ));
2021-09-20 01:52:52 -04:00
// $select_date_label = 'U lala lala';
2020-05-24 04:17:41 -04:00
$total_book = 0 ;
$post_id = $event_id ? $event_id : get_the_id ();
$event_meta = get_post_custom ( $post_id );
$event_expire_on_old = mep_get_option ( 'mep_event_expire_on_datetimes' , 'general_setting_sec' , 'event_start_datetime' );
2021-10-31 07:01:04 -04:00
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? esc_html ( 'event_expire_datetime' ) : $event_expire_on_old ;
2020-05-24 04:17:41 -04:00
$event_expire_date = $event_meta [ $event_expire_on ][ 0 ];
2020-07-12 06:42:13 -04:00
// $event_sqi = array_key_exists('mep_sqi',$event_meta) ? $event_meta['mep_sqi'][0] : '';
2021-10-29 17:14:29 -04:00
$mep_full_name = mage_array_strip ( $event_meta [ 'mep_full_name' ][ 0 ]);
$mep_reg_email = mage_array_strip ( $event_meta [ 'mep_reg_email' ][ 0 ]);
$mep_reg_phone = mage_array_strip ( $event_meta [ 'mep_reg_phone' ][ 0 ]);
$mep_reg_address = mage_array_strip ( $event_meta [ 'mep_reg_address' ][ 0 ]);
$mep_reg_designation = mage_array_strip ( $event_meta [ 'mep_reg_designation' ][ 0 ]);
$mep_reg_website = mage_array_strip ( $event_meta [ 'mep_reg_website' ][ 0 ]);
$mep_reg_veg = mage_array_strip ( $event_meta [ 'mep_reg_veg' ][ 0 ]);
$mep_reg_company = mage_array_strip ( $event_meta [ 'mep_reg_company' ][ 0 ]);
$mep_reg_gender = mage_array_strip ( $event_meta [ 'mep_reg_gender' ][ 0 ]);
$mep_reg_tshirtsize = mage_array_strip ( $event_meta [ 'mep_reg_tshirtsize' ][ 0 ]);
2020-05-24 04:17:41 -04:00
$time = strtotime ( $event_expire_date );
$newformat = date ( 'Y-m-d H:i:s' , $time );
$datetime1 = new DateTime ();
$datetime2 = new DateTime ( $newformat );
$interval = $datetime1 -> diff ( $datetime2 );
$mep_event_ticket_type = get_post_meta ( $post_id , 'mep_event_ticket_type' , true ) ? get_post_meta ( $post_id , 'mep_event_ticket_type' , true ) : array ();
$total_seat = apply_filters ( 'mep_event_total_seat_counts' , mep_event_total_seat ( $post_id , 'total' ), $post_id );
$total_resv = apply_filters ( 'mep_event_total_resv_seat_count' , mep_event_total_seat ( $post_id , 'resv' ), $post_id );
2022-10-31 22:09:15 -04:00
2022-11-07 02:13:48 -05:00
// $upcoming_date = !empty(mep_get_event_upcoming_date($post_id)) ? mep_get_event_upcoming_date($post_id) : '';
$upcoming_date = '' ;
2022-10-31 22:09:15 -04:00
$total_sold = mep_get_event_total_seat_left ( $post_id , $upcoming_date );
$total_left = $total_seat - ( $total_sold + $total_resv );
// $total_left = mep_get_event_total_seat_left($post_id, $upcoming_date);
2021-10-31 07:01:04 -04:00
$reg_status = array_key_exists ( 'mep_reg_status' , $event_meta ) ? esc_html ( $event_meta [ 'mep_reg_status' ][ 0 ]) : '' ;
2020-05-24 04:17:41 -04:00
$seat_left = apply_filters ( 'mep_event_total_seat_count' , $total_left , $post_id );
$current = current_time ( 'Y-m-d H:i:s' );
$time = strtotime ( $event_expire_date );
$newformat = date ( 'Y-m-d H:i:s' , $time );
$recurring = get_post_meta ( $post_id , 'mep_enable_recurring' , true ) ? get_post_meta ( $post_id , 'mep_enable_recurring' , true ) : 'no' ;
2020-03-19 08:34:31 -04:00
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
$event_more_dates = get_post_meta ( $post_id , 'mep_event_more_date' , true ) ? get_post_meta ( $post_id , 'mep_event_more_date' , true ) : array ();
$md = end ( $event_more_dates );
$more_date = $md [ 'event_more_start_date' ] . ' ' . $md [ 'event_more_start_time' ];
$newformat = empty ( $event_more_dates ) ? $newformat : date ( 'Y-m-d H:i:s' , strtotime ( $more_date ));
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
// $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
// date_default_timezone_set($default_timezone_val);
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
$datetime1 = new DateTime ( $newformat );
$datetime2 = new DateTime ( $current );
$interval = date_diff ( $datetime2 , $datetime1 );
$mep_available_seat = array_key_exists ( 'mep_available_seat' , $event_meta ) ? $event_meta [ 'mep_available_seat' ][ 0 ] : 'on' ;
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
$leftt = apply_filters ( 'mep_event_total_seat_count' , $total_left , $post_id );
$days = $interval -> d ;
$hours = $interval -> h ;
$minutes = $interval -> i ;
$dd = $days > 0 ? $days . " days " : '' ;
$hh = $hours > 0 ? $hours . " hours " : '' ;
$mm = $minutes > 0 ? $minutes . " minutes " : '' ;
2020-07-12 06:42:13 -04:00
// $qty_typec = array_key_exists('qty_box_type',$event_meta) ? $event_meta['qty_box_type'][0] : '';
2020-05-24 04:17:41 -04:00
$cart_product_id = get_post_meta ( $post_id , 'link_wc_product' , true ) ? esc_attr ( get_post_meta ( $post_id , 'link_wc_product' , true )) : esc_attr ( $post_id );
2021-09-03 06:25:05 -04:00
$not_in_the_cart = apply_filters ( 'mep_check_product_into_cart' , true , $cart_product_id );
2020-07-12 06:42:13 -04:00
2020-01-22 07:15:24 -05:00
2020-03-19 08:34:31 -04:00
/**
2020-05-24 04:17:41 -04:00
* First Checking If the registration status enable or disable
*/
if ( $reg_status != 'off' ) {
2020-03-19 08:34:31 -04:00
/**
2020-05-24 04:17:41 -04:00
* Then Checking If the event date already gone or not
*/
2020-07-12 06:42:13 -04:00
if ( strtotime ( current_time ( 'Y-m-d H:i:s' )) > strtotime ( apply_filters ( 'mep_event_expire_datetime_val' , $newformat , $post_id ))) {
2020-05-24 04:17:41 -04:00
/**
* If The event expired then it fire below Hook , The event expire texts arein the inc / template - parts / event_labels . php file
*/
do_action ( 'mep_event_expire_text' );
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
/**
* If the event is not expired then Its checking the available seat status
*/
} elseif ( $seat_left <= 0 ) {
/**
* If All the seats are booked then it fire the below hooks , The event no seat texts are in the inc / template - parts / event_labels . php file
*/
2020-09-14 00:50:46 -04:00
do_action ( 'mep_event_no_seat_text' , $post_id );
do_action ( 'mep_after_no_seat_notice' , $post_id );
2020-08-18 08:08:58 -04:00
2020-05-24 04:17:41 -04:00
} else {
/**
* If everything is fine then its go on ....
*/
2021-02-25 06:55:25 -05:00
if ( $event_member_type == 'for_all' || ( $event_member_type != 'for_all' && is_user_logged_in () && ( in_array ( wp_get_current_user () -> roles [ 0 ], $saved_user_role ) || in_array ( 'all' , $saved_user_role ) ) )){
2021-10-31 07:01:04 -04:00
?>
< input type = 'hidden' value = " <?php echo esc_attr( $extra_service_label ); ?> " id = 'mep_extra_service_label' />
< input type = 'hidden' value = " <?php echo esc_attr( $select_date_label ); ?> " id = 'mep_select_date_label' />
2021-02-25 06:55:25 -05:00
<!-- Register Now Title -->
< h4 class = " mep-cart-table-title " >
2021-10-31 07:01:04 -04:00
< ? php echo mep_get_option ( 'mep_register_now_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_register_now_text' , 'label_setting_sec' ) : esc_html__ ( 'Register Now:' , 'mage-eventpress' ); ?>
2020-05-24 04:17:41 -04:00
</ h4 >
<!-- The event add to cart main form start here -->
2022-08-23 02:57:23 -04:00
< form action = " " method = 'post' id = " mage_event_submit " enctype = " multipart/form-data " >
2022-06-27 00:31:32 -04:00
< input type = " hidden " name = '' id = 'mep_event_id' value = '<?php echo $event_id; ?>' >
< div class = " mpwemasp_ticket_area " >
2020-05-24 04:17:41 -04:00
< ? php
/**
* Here is a magic hook which fire just before of the Add to Cart Button , And the Ticket type & Extra service list are hooked up into this , You can find them into inc / template - parts / event_ticket_type_extra_service . php
*/
2021-09-03 06:25:05 -04:00
do_action ( 'mep_event_ticket_type_extra_service' , $post_id , $ticket_type_label , $extra_service_label , $select_date_label );
2020-05-24 04:17:41 -04:00
?>
< input type = 'hidden' id = 'rowtotal' value = " <?php echo get_post_meta( $post_id , " _price " , true); ?> " />
2021-03-02 07:27:25 -05:00
< input type = " hidden " name = 'currency_symbol' value = " <?php echo get_woocommerce_currency_symbol(); ?> " >
< input type = " hidden " name = 'currency_position' value = " <?php echo get_option('woocommerce_currency_pos'); ?> " >
< input type = " hidden " name = 'currency_decimal' value = " <?php echo wc_get_price_decimal_separator(); ?> " >
< input type = " hidden " name = 'currency_thousands_separator' value = " <?php echo wc_get_price_thousand_separator(); ?> " >
< input type = " hidden " name = 'currency_number_of_decimal' value = " <?php echo wc_get_price_decimals(); ?> " >
2021-09-03 06:25:05 -04:00
< ? php do_action ( 'mep_add_term_condition' , $post_id ); ?>
2022-06-27 00:31:32 -04:00
</ div >
2020-05-24 04:17:41 -04:00
<!-- The Add to cart button table start Here -->
< table class = 'table table-bordered mep_event_add_cart_table' >
< tr >
2021-08-08 01:03:30 -04:00
< td align = " left " class = 'total-col' >
< ? php do_action ( 'mep_before_price_calculation' , $post_id ); ?>
2021-10-31 07:01:04 -04:00
< ? php echo mep_get_option ( 'mep_quantity_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_quantity_text' , 'label_setting_sec' ) : esc_html__ ( 'Quantity:' , 'mage-eventpress' );
2020-05-24 04:17:41 -04:00
if ( $mep_event_ticket_type ) { ?>
2021-10-31 07:01:04 -04:00
< input id = " quantity_5a7abbd1bff73 " class = " input-text qty text extra-qty-box " step = " 1 " min = " 1 " max = " <?php echo esc_attr( $leftt ); ?> " name = " quantity " value = " 1 " title = " Qty " size = " 4 " pattern = " [0-9]* " inputmode = " numeric " type = " hidden " >
2020-05-24 04:17:41 -04:00
< span id = " ttyttl " ></ span >
< ? php } ?>
2021-10-31 07:01:04 -04:00
< span class = 'the-total' > < ? php echo mep_get_option ( 'mep_total_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_total_text' , 'label_setting_sec' ) : esc_html__ ( 'Total' , 'mage-eventpress' ); ?>
2020-05-24 04:17:41 -04:00
< span id = " usertotal " ></ span >
</ span >
2021-08-08 01:03:30 -04:00
< ? php do_action ( 'mep_after_price_calculation' , $post_id ); ?>
2020-05-24 04:17:41 -04:00
</ td >
< td align = " right " >
2021-08-08 01:03:30 -04:00
< ? php do_action ( 'mep_before_add_cart_btn' , $post_id ); ?>
2020-05-24 04:17:41 -04:00
< input type = " hidden " name = " mep_event_location_cart " value = " <?php trim(mep_ev_location_ticket( $post_id , $event_meta )); ?> " >
2021-11-24 01:51:57 -05:00
< input type = " hidden " name = " mep_event_date_cart " value = " <?php //do_action('mep_event_date'); ?> " >
2022-06-27 00:31:32 -04:00
< ? php if ( $not_in_the_cart && class_exists ( 'MP_ESP_Frontend' ) && sizeof ( $seat_plan ) > 0 && $seat_plan_visible == 2 && $new_registration_system_sp == 'on' ){ ?>
< button type = " submit " class = " mpwemasp_get_sp " >< ? php esc_html_e ( " View Seat Plan " , " mage-eventpress " ); ?> </button>
< ? php } if ( $not_in_the_cart ){ ?>
2022-10-31 22:09:15 -04:00
< button type = " submit " name = " add-to-cart " value = " <?php echo esc_attr( $cart_product_id ); ?> " class = " button-default woocommerce button alt button alt btn-mep-event-cart " >< ? php do_action ( 'mep_before_add_cart_button' , $post_id ); echo " <span class='mep-cart-btn-text'> " . esc_html ( $cart_btn_label ) . " </span> " ; do_action ( 'mep_after_add_cart_button' , $post_id ); ?> </button>
2022-06-27 00:31:32 -04:00
< ? php } else { ?>
2021-10-31 07:01:04 -04:00
< a href = " <?php echo wc_get_cart_url(); ?> " class = " button-default woocommerce button alt button alt btn-mep-event-cart " >< ? php esc_html_e ( 'Already Added into Cart! View Cart' , 'mage-eventpress' ); ?> </a>
2022-06-27 00:31:32 -04:00
< ? php } ?>
2021-08-08 01:03:30 -04:00
< ? php do_action ( 'mep_after_add_cart_btn' , $post_id ); ?>
2020-05-24 04:17:41 -04:00
</ td >
</ tr >
</ table >
<!-- The Add to cart button table start Here -->
</ form >
<!-- The event add to cart main form end here -->
2021-10-31 07:01:04 -04:00
< ? php
2021-02-25 06:55:25 -05:00
} else {
2021-10-31 07:01:04 -04:00
?>
< span class = " mep_warning " >
< ? php
esc_html_e ( " Whoops, this event for members only. Login to view content. Not a member? That's easy. " , " mage-eventpress " );
?>
</ span >
< ? php
}
2021-02-25 06:55:25 -05:00
}
2022-06-27 00:31:32 -04:00
} // End Of checking Registration status
}
//}
2020-05-24 04:17:41 -04:00
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
add_action ( 'mep_add_to_cart_list' , 'mep_get_event_reg_btn_list' );
if ( ! function_exists ( 'mep_get_event_reg_btn_list' )) {
// Get Event Registration Button
function mep_get_event_reg_btn_list ()
{
global $post , $event_meta ;
$total_book = 0 ;
$post_id = $post -> ID ;
$event_meta = get_post_custom ( $post_id );
$event_expire_on_old = mep_get_option ( 'mep_event_expire_on_datetimes' , 'general_setting_sec' , 'event_start_datetime' );
2021-10-31 07:01:04 -04:00
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? esc_html ( 'event_expire_datetime' ) : $event_expire_on_old ;
2020-05-24 04:17:41 -04:00
$event_expire_date = $event_meta [ $event_expire_on ][ 0 ];
2020-07-12 06:42:13 -04:00
// $event_sqi = $event_meta['mep_sqi'][0];
2021-10-29 17:14:29 -04:00
$mep_full_name = mage_array_strip ( $event_meta [ 'mep_full_name' ][ 0 ]);
$mep_reg_email = mage_array_strip ( $event_meta [ 'mep_reg_email' ][ 0 ]);
$mep_reg_phone = mage_array_strip ( $event_meta [ 'mep_reg_phone' ][ 0 ]);
$mep_reg_address = mage_array_strip ( $event_meta [ 'mep_reg_address' ][ 0 ]);
$mep_reg_designation = mage_array_strip ( $event_meta [ 'mep_reg_designation' ][ 0 ]);
$mep_reg_website = mage_array_strip ( $event_meta [ 'mep_reg_website' ][ 0 ]);
$mep_reg_veg = mage_array_strip ( $event_meta [ 'mep_reg_veg' ][ 0 ]);
$mep_reg_company = mage_array_strip ( $event_meta [ 'mep_reg_company' ][ 0 ]);
$mep_reg_gender = mage_array_strip ( $event_meta [ 'mep_reg_gender' ][ 0 ]);
$mep_reg_tshirtsize = mage_array_strip ( $event_meta [ 'mep_reg_tshirtsize' ][ 0 ]);
2022-10-31 22:09:15 -04:00
2020-05-24 04:17:41 -04:00
// $simple_rsv = array_key_exists('mep_rsv_seat', $event_meta) ? $event_meta['mep_rsv_seat'][0] : 0;
// $total_book = ($total_book + $simple_rsv);
// $seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book);
2022-10-31 22:09:15 -04:00
2020-05-24 04:17:41 -04:00
$time = strtotime ( $event_expire_date );
$newformat = date ( 'Y-m-d H:i:s' , $time );
$datetime1 = new DateTime ();
$datetime2 = new DateTime ( $newformat );
$interval = $datetime1 -> diff ( $datetime2 );
$mep_event_ticket_type = get_post_meta ( $post_id , 'mep_event_ticket_type' , true ) ? get_post_meta ( $post_id , 'mep_event_ticket_type' , true ) : array ();
$total_seat = mep_event_total_seat ( get_the_id (), 'total' );
$total_resv = mep_event_total_seat ( get_the_id (), 'resv' );
2022-10-31 22:09:15 -04:00
2022-11-07 02:13:48 -05:00
// $upcoming_date = !empty(mep_get_event_upcoming_date($post_id)) ? mep_get_event_upcoming_date($post_id) : '';
$upcoming_date = '' ;
2022-10-31 22:09:15 -04:00
$total_sold = mep_get_event_total_seat_left ( $post_id , $upcoming_date );
$total_left = $total_seat - ( $total_sold + $total_resv );
// $total_left = mep_get_event_total_seat_left($post_id, $upcoming_date);
2020-05-24 04:17:41 -04:00
$reg_status = array_key_exists ( 'mep_reg_status' , $event_meta ) ? $event_meta [ 'mep_reg_status' ][ 0 ] : '' ;
$seat_left = apply_filters ( 'mep_event_total_seat_count' , $total_left , get_the_id ());
$current = current_time ( 'Y-m-d H:i:s' );
$time = strtotime ( $event_expire_date );
$newformat = date ( 'Y-m-d H:i:s' , $time );
$recurring = get_post_meta ( $post_id , 'mep_enable_recurring' , true ) ? get_post_meta ( $post_id , 'mep_enable_recurring' , true ) : 'no' ;
2020-03-19 08:34:31 -04:00
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
$event_more_dates = get_post_meta ( $post_id , 'mep_event_more_date' , true ) ? get_post_meta ( $post_id , 'mep_event_more_date' , true ) : array ();
$md = end ( $event_more_dates );
$more_date = $md [ 'event_more_start_date' ] . ' ' . $md [ 'event_more_start_time' ];
$newformat = empty ( $event_more_dates ) ? $newformat : date ( 'Y-m-d H:i:s' , strtotime ( $more_date ));
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
// $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
// date_default_timezone_set($default_timezone_val);
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
$datetime1 = new DateTime ( $newformat );
$datetime2 = new DateTime ( $current );
$interval = date_diff ( $datetime2 , $datetime1 );
$mep_available_seat = array_key_exists ( 'mep_available_seat' , $event_meta ) ? $event_meta [ 'mep_available_seat' ][ 0 ] : 'on' ;
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
$leftt = apply_filters ( 'mep_event_total_seat_count' , $total_left , get_the_id ());
$days = $interval -> d ;
$hours = $interval -> h ;
$minutes = $interval -> i ;
$dd = $days > 0 ? $days . " days " : '' ;
$hh = $hours > 0 ? $hours . " hours " : '' ;
$mm = $minutes > 0 ? $minutes . " minutes " : '' ;
2020-07-12 06:42:13 -04:00
// $qty_typec = $event_meta['qty_box_type'][0];
2021-10-31 07:01:04 -04:00
$cart_product_id = get_post_meta ( $post_id , 'link_wc_product' , true ) ? esc_html ( get_post_meta ( $post_id , 'link_wc_product' , true )) : esc_html ( $post_id );
2021-09-03 06:25:05 -04:00
$not_in_the_cart = apply_filters ( 'mep_check_product_into_cart' , true , $cart_product_id );
2020-03-19 08:34:31 -04:00
/**
2020-05-24 04:17:41 -04:00
* First Checking If the registration status enable or disable
*/
if ( $reg_status != 'off' ) {
2020-03-19 08:34:31 -04:00
/**
2020-05-24 04:17:41 -04:00
* Then Checking If the event date already gone or not
*/
if ( strtotime ( current_time ( 'Y-m-d H:i:s' )) > strtotime ( $newformat )) {
/**
* If The event expired then it fire below Hook , The event expire texts arein the inc / template - parts / event_labels . php file
*/
do_action ( 'mep_event_expire_text' );
/**
* If the event is not expired then Its checking the available seat status
*/
} elseif ( $seat_left <= 0 ) {
/**
* If All the seats are booked then it fire the below hooks , The event no seat texts are in the inc / template - parts / event_labels . php file
*/
2020-09-14 00:50:46 -04:00
do_action ( 'mep_event_no_seat_text' , $post_id );
do_action ( 'mep_after_no_seat_notice' , $post_id );
2020-05-24 04:17:41 -04:00
} else {
/**
* If everything is fine then its go on ....
*/
?>
<!-- Register Now Title -->
< h4 class = " mep-cart-table-title " >
2021-10-31 07:01:04 -04:00
< ? php echo mep_get_option ( 'mep_register_now_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_register_now_text' , 'label_setting_sec' ) : esc_html__ ( 'Register Now:' , 'mage-eventpress' ); ?>
2020-05-24 04:17:41 -04:00
</ h4 >
<!-- The event add to cart main form start here -->
2022-08-23 02:57:23 -04:00
< form action = " " method = 'post' id = " mage_event_submit " enctype = " multipart/form-data " >
2020-05-24 04:17:41 -04:00
< ? php
/**
* Here is a magic hook which fire just before of the Add to Cart Button , And the Ticket type & Extra service list are hooked up into this , You can find them into inc / template - parts / event_ticket_type_extra_service . php
*/
do_action ( 'mep_event_ticket_types_list' );
do_action ( 'mep_event_extra_service_list' );
?>
< input type = 'hidden' id = 'rowtotal' value = " <?php echo get_post_meta( $post_id , " _price " , true); ?> " />
2021-03-02 07:27:25 -05:00
< input type = " hidden " name = 'currency_symbol' value = " <?php echo get_woocommerce_currency_symbol(); ?> " >
< input type = " hidden " name = 'currency_position' value = " <?php echo get_option('woocommerce_currency_pos'); ?> " >
< input type = " hidden " name = 'currency_decimal' value = " <?php echo wc_get_price_decimal_separator(); ?> " >
< input type = " hidden " name = 'currency_thousands_separator' value = " <?php echo wc_get_price_thousand_separator(); ?> " >
< input type = " hidden " name = 'currency_number_of_decimal' value = " <?php echo wc_get_price_decimals(); ?> " >
2021-09-03 06:25:05 -04:00
< ? php do_action ( 'mep_add_term_condition' , $post_id ); ?>
<!-- The Add to cart button table start Here fff -->
2021-09-20 01:52:52 -04:00
< table class = 'table table-bordered mep_event_add_cart_table' >
2020-05-24 04:17:41 -04:00
< tr >
2021-10-31 07:01:04 -04:00
< td align = " left " class = 'total-col' >< ? php echo mep_get_option ( 'mep_quantity_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_quantity_text' , 'label_setting_sec' ) : esc_html_e ( 'Quantity:' , 'mage-eventpress' );
2020-05-24 04:17:41 -04:00
if ( $mep_event_ticket_type ) { ?>
2021-10-31 07:01:04 -04:00
< input id = " quantity_5a7abbd1bff73 " class = " input-text qty text extra-qty-box " step = " 1 " min = " 1 " max = " <?php echo esc_attr( $leftt ); ?> " name = " quantity " value = " 1 " title = " Qty " size = " 4 " pattern = " [0-9]* " inputmode = " numeric " type = " hidden " >
2020-05-24 04:17:41 -04:00
< span id = " ttyttl " ></ span >
< ? php } ?>
2021-10-31 07:01:04 -04:00
< span class = 'the-total' > < ? php echo mep_get_option ( 'mep_total_text' , 'label_setting_sec' ) ? mep_get_option ( 'mep_total_text' , 'label_setting_sec' ) : esc_html_e ( 'Total' , 'mage-eventpress' ); ?>
2020-05-24 04:17:41 -04:00
< span id = " usertotal " ></ span >
</ span >
</ td >
2021-09-20 01:52:52 -04:00
< td align = " right " class = 'mep-event-cart-btn-sec' >
2020-05-24 04:17:41 -04:00
< input type = " hidden " name = " mep_event_location_cart " value = " <?php trim(mep_ev_location_ticket( $post_id , $event_meta )); ?> " >
2021-11-24 01:51:57 -05:00
< input type = " hidden " name = " mep_event_date_cart " value = " <?php //do_action('mep_event_date'); ?> " >
2021-09-03 06:25:05 -04:00
< ? php if ( $not_in_the_cart ){ ?>
2022-10-31 22:09:15 -04:00
< button type = " submit " name = " add-to-cart " value = " <?php echo esc_html( $cart_product_id ); ?> " class = " button-default woocommerce button alt button alt btn-mep-event-cart " >< ? php do_action ( 'mep_before_add_cart_button' , $post_id ); esc_html_e ( mep_get_label ( $post_id , 'mep_cart_btn_text' , 'Register This Event' ), 'mage-eventpress' ); do_action ( 'mep_after_add_cart_button' , $post_id ); ?> </button>
2021-09-03 06:25:05 -04:00
< ? php } else { ?>
2021-10-31 07:01:04 -04:00
< a href = " <?php echo wc_get_cart_url(); ?> " class = " button-default woocommerce button alt button alt btn-mep-event-cart " >< ? php esc_html_e ( 'Already Added into Cart!' , 'mage-eventpress' ); ?> </a>
2021-09-03 06:25:05 -04:00
< ? php } ?>
2020-05-24 04:17:41 -04:00
</ td >
</ tr >
</ table >
<!-- The Add to cart button table start Here -->
</ form >
<!-- The event add to cart main form end here -->
2020-01-22 07:15:24 -05:00
< ? php
2020-05-24 04:17:41 -04:00
}
} // End Of checking Registration status
}
2022-10-31 22:09:15 -04:00
}