function update

This commit is contained in:
magepeopleteam 2022-11-07 07:05:59 +00:00
parent 69c9301929
commit 58b755ac52
3 changed files with 19 additions and 13 deletions

View File

@ -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';
@ -2389,9 +2399,9 @@ if (!function_exists('mep_get_event_total_seat')) {
?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;">
<?php
$sold = ($total_seat - $total_left);
$seat_count_var = apply_filters('mep_event_total_seat_counts', $total_seat, $event_id) . ' - ' . apply_filters('mep_event_total_seat_sold', ($total_seat - $total_left), $event_id, $event_date) . ' = ' . apply_filters('mep_event_total_seat_left', $total_left, $event_id, '', $event_date);
echo apply_filters('mep_event_seat_status_text', $seat_count_var, $total_seat, $sold, $total_left);
// $sold = ($total_seat - $total_left);
$seat_count_var = apply_filters('mep_event_total_seat_counts', $total_seat, $event_id) . ' - ' . apply_filters('mep_event_total_seat_sold', $total_sold, $event_id, $event_date) . ' = ' . apply_filters('mep_event_total_seat_left', $total_left, $event_id, '', $event_date);
echo apply_filters('mep_event_seat_status_text', $seat_count_var, $total_seat, $total_sold, $total_left);
?>
</span>
<?php

View File

@ -17,17 +17,13 @@ if (!function_exists('mep_ev_seat')) {
$event_date = get_post_meta($event_id, 'event_start_date', true) ? get_post_meta($event_id, 'event_start_date', true) : '';
$mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on';
if (is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 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_seat = apply_filters('mep_event_total_seat_count', $_total_left, $event_id,'',$event_date);
require(mep_template_file_path('single/total_seat.php'));
}
}