diff --git a/inc/mep_functions.php b/inc/mep_functions.php index db9afe8..9883aea 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -1043,7 +1043,8 @@ function mep_update_event_total_seat($event_id,$date=''){ update_post_meta($event_id,'mep_total_seat_left',$seat_left); if(!empty($date)){ - $event_name = $event_id.'_'.$date; + $_date = !empty($date) ? date('YmdHi',strtotime($date)) : 0; + $event_name = $event_id.'_'.$_date; $seat_left_date = mep_get_count_total_available_seat($event_id, $date); update_post_meta($event_id,$event_name,$seat_left_date); } @@ -1054,6 +1055,15 @@ function mep_update_event_total_seat($event_id,$date=''){ } + + + +function mep_update_total_seat_on_demand($event_id){ + $upcoming_date = !empty(mep_get_event_upcoming_date($event_id)) ? mep_get_event_upcoming_date($event_id) : ''; + mep_update_event_total_seat($event_id,$upcoming_date); +} + + function mep_get_event_total_seat_left($event_id,$date=''){ $date = !empty($date) ? date('YmdHi',strtotime($date)) : 0; $meta_name = $date > 0 ? $event_id.'_'.$date : 'mep_total_seat_left'; @@ -2367,7 +2377,7 @@ if (!function_exists('mep_get_event_total_seat')) { $total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($event_id, 'resv'), $event_id); $total_sold = mep_get_event_total_seat_left($event_id, $upcoming_date); - // $total_sold = mep_ticket_type_sold($event_id); + //$total_sold = mep_ticket_type_sold($event_id); $total_left = (int) $total_seat - ((int) $total_sold + (int) $total_resv); $event_date = date('Y-m-d H:i', strtotime(mep_get_event_upcoming_date($event_id))); @@ -2389,9 +2399,9 @@ if (!function_exists('mep_get_event_total_seat')) { ?> 0) { - $upcoming_date = !empty(mep_get_event_upcoming_date($event_id)) ? mep_get_event_upcoming_date($event_id) : ''; + $upcoming_date = ''; $total_seat = apply_filters('mep_event_total_seat_counts', mep_event_total_seat($event_id, 'total'), $event_id); $total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($event_id, 'resv'), $event_id); +// $total_sold = mep_ticket_type_sold($event_id); $total_sold = mep_get_event_total_seat_left($event_id, $upcoming_date); - $total_left = (int) $total_seat - ((int) $total_sold + (int) $total_resv); - - - - + $total_left = (int) $total_seat - ((int) $total_sold + (int) $total_resv); // $total_seat = apply_filters('mep_event_total_seat_count', $_total_left, $event_id,'',$event_date); - require(mep_template_file_path('single/total_seat.php')); } }