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

@ -1480,6 +1480,19 @@ if (!function_exists('mep_get_total_available_seat')) {
} }
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')) {
function mep_event_location_item($event_id,$item_name){ function mep_event_location_item($event_id,$item_name){
return get_post_meta($event_id,$item_name,true); return get_post_meta($event_id,$item_name,true);
@ -1976,48 +1989,33 @@ 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){
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array( // echo $date;
'relation' => 'AND',
array( $type_filter = !empty($type) ? array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_ticket_type', 'key' => 'ea_ticket_type',
'value' => $type, 'value' => $type,
'compare' => '=' 'compare' => '='
), ) : '';
array(
$date_filter = !empty($date) ? array(
'key' => 'ea_event_date', 'key' => 'ea_event_date',
'value' => $date, 'value' => $date,
'compare' => 'LIKE' 'compare' => 'LIKE'
) ) : '';
),array( $processing_status_filter = array(
'relation' => 'OR',
array(
'key' => 'ea_order_status', 'key' => 'ea_order_status',
'value' => 'processing', 'value' => 'processing',
'compare' => '=' 'compare' => '='
), );
array( $completed_status_filter = array(
'key' => 'ea_order_status', 'key' => 'ea_order_status',
'value' => 'completed', 'value' => 'completed',
'compare' => '=' 'compare' => '='
)
)
)
); );
}else{
$args = array( $args = array(
'post_type' => 'mep_events_attendees', 'post_type' => 'mep_events_attendees',
'posts_per_page' => -1, 'posts_per_page' => -1,
@ -2030,28 +2028,20 @@ if (!function_exists('mep_ticket_type_sold')) {
'value' => $event_id, 'value' => $event_id,
'compare' => '=' 'compare' => '='
), ),
array( $type_filter,
'key' => 'ea_ticket_type', $date_filter
'value' => $type,
'compare' => '='
)
),array( ),array(
'relation' => 'OR', 'relation' => 'OR',
array( $processing_status_filter,
'key' => 'ea_order_status', $completed_status_filter
'value' => 'processing',
'compare' => '='
),
array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
)
) )
) )
); );
}
$loop = new WP_Query($args); $loop = new WP_Query($args);
// echo $loop->post_count;
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>

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'));
} }