function update

This commit is contained in:
magepeopleteam 2020-12-15 12:27:38 +00:00
parent e894a11c36
commit 68c5fa9bb0
4 changed files with 71 additions and 81 deletions

View File

@ -1478,6 +1478,19 @@ if (!function_exists('mep_get_total_available_seat')) {
return $total_left; return $total_left;
} }
} }
if (!function_exists('mep_get_event_total_available_seat')) {
function mep_get_event_total_available_seat($event_id, $date){
// echo $date;
$total_seat = mep_event_total_seat($event_id,'total');
$total_resv = mep_event_total_seat($event_id,'resv');
$total_sold = mep_ticket_type_sold($event_id,'',$date);
$total_left = $total_seat - ($total_sold + $total_resv);
return $total_left;
}
}
if (!function_exists('mep_event_location_item')) { if (!function_exists('mep_event_location_item')) {
@ -1976,82 +1989,59 @@ if (!function_exists('mep_get_term_as_class')) {
} }
if (!function_exists('mep_ticket_type_sold')) { if (!function_exists('mep_ticket_type_sold')) {
function mep_ticket_type_sold($event_id,$type,$date=''){ function mep_ticket_type_sold($event_id,$type='',$date=''){
if($date){
// echo $date;
$type_filter = !empty($type) ? array(
'key' => 'ea_ticket_type',
'value' => $type,
'compare' => '='
) : '';
$date_filter = !empty($date) ? array(
'key' => 'ea_event_date',
'value' => $date,
'compare' => 'LIKE'
) : '';
$processing_status_filter = array(
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
);
$completed_status_filter = array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
);
$args = array( $args = array(
'post_type' => 'mep_events_attendees', 'post_type' => 'mep_events_attendees',
'posts_per_page' => -1, 'posts_per_page' => -1,
'meta_query' => array(
'meta_query' => array( 'relation' => 'AND',
'relation' => 'AND', array(
array( 'relation' => 'AND',
'relation' => 'AND', array(
array( 'key' => 'ea_event_id',
'key' => 'ea_event_id', 'value' => $event_id,
'value' => $event_id, 'compare' => '='
'compare' => '=' ),
), $type_filter,
array( $date_filter
'key' => 'ea_ticket_type', ),array(
'value' => $type, 'relation' => 'OR',
'compare' => '=' $processing_status_filter,
), $completed_status_filter
array(
'key' => 'ea_event_date',
'value' => $date,
'compare' => 'LIKE'
) )
),array( )
'relation' => 'OR', );
array( $loop = new WP_Query($args);
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
), // echo $loop->post_count;
array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
)
)
)
);
}else{
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_ticket_type',
'value' => $type,
'compare' => '='
)
),array(
'relation' => 'OR',
array(
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
),
array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
)
)
)
);
}
$loop = new WP_Query($args);
return $loop->post_count; return $loop->post_count;
} }
} }
@ -2995,7 +2985,7 @@ add_action('mep_event_admin_booking_js','mep_single_page_js_script');
if (!function_exists('mep_single_page_js_script')) { if (!function_exists('mep_single_page_js_script')) {
function mep_single_page_js_script($event_id){ function mep_single_page_js_script($event_id){
$currency_pos = get_option('woocommerce_currency_pos'); $currency_pos = get_option('woocommerce_currency_pos');
$mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? get_post_meta($event_id, 'mep_event_faq', true) : []; $mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? maybe_unserialize(get_post_meta($event_id, 'mep_event_faq', true)) : [];
ob_start(); ob_start();
?> ?>
<script> <script>
@ -3429,10 +3419,10 @@ if($thumbnail_id > 0){
add_action('mep_event_list_date_li','mep_event_list_upcoming_date_li',10,2); add_action('mep_event_list_date_li','mep_event_list_upcoming_date_li',10,2);
function mep_event_list_upcoming_date_li($event_id,$type='grid'){ function mep_event_list_upcoming_date_li($event_id,$type='grid'){
$hide_only_end_time_list = mep_get_option('mep_event_hide_end_time_list', 'general_setting_sec', 'no'); $hide_only_end_time_list = mep_get_option('mep_event_hide_end_time_list', 'general_setting_sec', 'no');
$event_start_datetime = get_post_meta($event_id,'event_start_datetime',true); $event_start_datetime = get_post_meta($event_id,'event_start_datetime',true);
$event_end_datetime = get_post_meta($event_id,'event_end_datetime',true); $event_end_datetime = get_post_meta($event_id,'event_end_datetime',true);
$event_multidate = get_post_meta($event_id,'mep_event_more_date',true) ? get_post_meta($event_id,'mep_event_more_date',true) : []; $event_multidate = get_post_meta($event_id,'mep_event_more_date',true) ? get_post_meta($event_id,'mep_event_more_date',true) : [];
$event_std[] = array( $event_std[] = array(
'event_std' => $event_start_datetime, 'event_std' => $event_start_datetime,
'event_etd' => $event_end_datetime 'event_etd' => $event_end_datetime

View File

@ -23,7 +23,7 @@ if (!function_exists('mep_display_event_daywise_details')) {
function mep_display_event_daywise_details() function mep_display_event_daywise_details()
{ {
global $post, $event_meta; global $post, $event_meta;
$mep_event_day = get_post_meta($post->ID, 'mep_event_day', true) ? get_post_meta($post->ID, 'mep_event_day', true) : array(); $mep_event_day = get_post_meta($post->ID, 'mep_event_day', true) ? maybe_unserialize(get_post_meta($post->ID, 'mep_event_day', true)) : array();
if (sizeof($mep_event_day) > 0) { if (sizeof($mep_event_day) > 0) {
require(mep_template_file_path('single/daywise_details.php')); require(mep_template_file_path('single/daywise_details.php'));
} }

View File

@ -8,7 +8,7 @@ if (!function_exists('mep_faq_part')) {
function mep_faq_part($event_id) function mep_faq_part($event_id)
{ {
ob_start(); ob_start();
$mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? get_post_meta($event_id, 'mep_event_faq', true) : ''; $mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? maybe_unserialize(get_post_meta($event_id, 'mep_event_faq', true)) : '';
if ($mep_event_faq) { if ($mep_event_faq) {
require(mep_template_file_path('single/faq.php')); require(mep_template_file_path('single/faq.php'));
} }

View File

@ -228,4 +228,4 @@ jQuery('#quantity_5a7abbd1bff73').on('change', function () {
} }
do_action('mep_event_single_page_before_footer'); do_action('mep_event_single_page_before_footer');
} }
get_footer(); get_footer();