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); update_post_meta($event_id,'mep_total_seat_left',$seat_left);
if(!empty($date)){ 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); $seat_left_date = mep_get_count_total_available_seat($event_id, $date);
update_post_meta($event_id,$event_name,$seat_left_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=''){ function mep_get_event_total_seat_left($event_id,$date=''){
$date = !empty($date) ? date('YmdHi',strtotime($date)) : 0; $date = !empty($date) ? date('YmdHi',strtotime($date)) : 0;
$meta_name = $date > 0 ? $event_id.'_'.$date : 'mep_total_seat_left'; $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_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_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); $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))); $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')) {
?> ?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <span style="background: #dc3232;color: #fff;padding: 5px 10px;">
<?php <?php
$sold = ($total_seat - $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_seat - $total_left), $event_id, $event_date) . ' = ' . apply_filters('mep_event_total_seat_left', $total_left, $event_id, '', $event_date); $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, $sold, $total_left); echo apply_filters('mep_event_seat_status_text', $seat_count_var, $total_seat, $total_sold, $total_left);
?> ?>
</span> </span>
<?php <?php

View File

@ -52,7 +52,7 @@ if (!function_exists('mep_get_event_reg_btn')) {
$total_seat = apply_filters('mep_event_total_seat_counts', mep_event_total_seat($post_id, 'total'), $post_id); $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); $total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($post_id, 'resv'), $post_id);
$upcoming_date = !empty(mep_get_event_upcoming_date($post_id)) ? mep_get_event_upcoming_date($post_id) : ''; $upcoming_date = !empty(mep_get_event_upcoming_date($post_id)) ? mep_get_event_upcoming_date($post_id) : '';
$total_sold = mep_get_event_total_seat_left($post_id, $upcoming_date); $total_sold = mep_get_event_total_seat_left($post_id, $upcoming_date);
$total_left = $total_seat - ($total_sold + $total_resv); $total_left = $total_seat - ($total_sold + $total_resv);
// $total_left = mep_get_event_total_seat_left($post_id, $upcoming_date); // $total_left = mep_get_event_total_seat_left($post_id, $upcoming_date);

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) : ''; $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'; $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) { 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_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_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_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); // $total_seat = apply_filters('mep_event_total_seat_count', $_total_left, $event_id,'',$event_date);
require(mep_template_file_path('single/total_seat.php')); require(mep_template_file_path('single/total_seat.php'));
} }
} }