2018-07-02 05:44:24 -04:00
|
|
|
<?php
|
|
|
|
add_action('mep_event_seat','mep_ev_seat');
|
|
|
|
|
|
|
|
|
|
|
|
function mep_ev_seat(){
|
2019-01-31 06:55:36 -05:00
|
|
|
global $post,$event_meta,$total_book;
|
|
|
|
|
|
|
|
$simple_rsv = $event_meta['mep_rsv_seat'][0];
|
|
|
|
if($simple_rsv){
|
|
|
|
$simple_rsv = $simple_rsv;
|
|
|
|
}else{
|
|
|
|
$simple_rsv = 0;
|
|
|
|
}
|
|
|
|
$total_book = ($total_book + $simple_rsv);
|
|
|
|
|
2018-07-02 05:44:24 -04:00
|
|
|
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
|
2019-01-31 06:55:36 -05:00
|
|
|
|
|
|
|
|
2018-11-29 02:08:43 -05:00
|
|
|
if(array_key_exists('mep_available_seat', $event_meta)){
|
|
|
|
$mep_available_seat = $event_meta['mep_available_seat'][0];
|
|
|
|
}else{
|
|
|
|
$mep_available_seat = 'on';
|
|
|
|
}
|
|
|
|
|
2018-07-02 05:44:24 -04:00
|
|
|
if($mep_event_ticket_type){
|
|
|
|
|
|
|
|
$stc = 0;
|
|
|
|
$leftt = 0;
|
2019-01-31 06:55:36 -05:00
|
|
|
$res = 0;
|
2018-07-02 05:44:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
foreach ( $mep_event_ticket_type as $field ) {
|
|
|
|
$qm = $field['option_name_t'];
|
|
|
|
$tesqn = $post->ID.str_replace(' ', '', $qm);
|
|
|
|
|
|
|
|
$tesq = get_post_meta($post->ID,"mep_xtra_$tesqn",true);
|
|
|
|
|
|
|
|
$stc = $stc+$field['option_qty_t'];
|
|
|
|
|
2019-01-31 06:55:36 -05:00
|
|
|
$res = $res + (int)$field['option_rsv_t'];
|
|
|
|
|
|
|
|
$res = (int)$res;
|
|
|
|
|
2018-07-02 05:44:24 -04:00
|
|
|
|
2018-11-29 02:08:43 -05:00
|
|
|
$llft = ($field['option_qty_t'] - (int)$tesq);
|
2019-01-31 06:55:36 -05:00
|
|
|
$leftt = ($leftt+$llft);
|
2018-07-02 05:44:24 -04:00
|
|
|
}
|
2019-01-31 06:55:36 -05:00
|
|
|
$leftt = $leftt-$res;
|
2018-07-02 05:44:24 -04:00
|
|
|
?>
|
2019-01-22 06:02:55 -05:00
|
|
|
<h5><strong><?php _e('Total Seat:','mage-eventpress'); ?></strong> <?php echo $stc; if($mep_available_seat=='on'){ ?> (<strong><?php echo $leftt; ?></strong> <?php _e('Left','mage-eventpress'); ?>)<?php } ?></h5>
|
2018-07-02 05:44:24 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
}else{
|
|
|
|
if($event_meta['mep_total_seat'][0]){ ?>
|
2019-01-22 06:02:55 -05:00
|
|
|
<h5><strong><?php _e('Total Seat:','mage-eventpress'); ?></strong> <?php echo $event_meta['mep_total_seat'][0]; if($mep_available_seat=='on'){ ?> (<strong><?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?></strong> <?php _e('Left','mage-eventpress'); ?>) <?php } ?></h5>
|
2018-07-02 05:44:24 -04:00
|
|
|
<?php }
|
|
|
|
}
|
|
|
|
|
2018-11-29 02:08:43 -05:00
|
|
|
}
|