diff --git a/inc/mep_functions.php b/inc/mep_functions.php index 4d2202e..e0832da 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -384,7 +384,7 @@ function mep_get_event_ticket_price_by_name($event, $type) { if (sizeof($ticket_type) > 0) { foreach ($ticket_type as $key => $val) { if ($val['option_name_t'] === $type) { - return $val['option_price_t']; + return array_key_exists('option_price_t',$val) ? $val['option_price_t'] : 0; } } return 0; @@ -409,7 +409,7 @@ function mep_get_ticket_price_by_event($event, $type, $default_price = 0) { $all_ticket_tyle = get_post_meta($event, 'mep_event_ticket_type', true); foreach ($all_ticket_tyle as $key => $val) { if ($val['option_name_t'] === $type) { - return (int)$val['option_price_t']; + return array_key_exists('option_price_t',$val) ? (int)$val['option_price_t'] : 0; } } } else { @@ -1023,7 +1023,7 @@ if (!function_exists('mep_attendee_status_update')) { $event_ticket_info_arr = wc_get_order_item_meta($item_id,'_event_ticket_info',true); $org = get_the_terms($event_id, 'mep_org'); - $term_id = $org[0]->term_id; + $term_id = isset($org[0]->term_id) ? $org[0]->term_id : ''; $org_email = get_term_meta( $term_id, 'org_email', true ) ? get_term_meta( $term_id, 'org_email', true ) : ''; if ($order->has_status('processing')) { @@ -1249,7 +1249,7 @@ function mep_get_ticket_type_info_by_name($name, $event_id, $type ='option_qty_t foreach ($ticket_type_arr as $price) { $TicketName = str_replace("'", "", $price['option_name_t']); if ($TicketName === $name) { - $p = $price[$type]; + $p = array_key_exists($type,$price) ? $price[$type] : ''; } } return $p; @@ -3479,7 +3479,7 @@ function mep_get_ticket_type_price_by_name($name, $event_id) { foreach ($ticket_type_arr as $price) { $TicketName = str_replace("'", "", $price['option_name_t']); if ($TicketName === $name) { - $p = $price['option_price_t']; + $p = array_key_exists('option_price_t',$price) ? esc_html($price['option_price_t']) : 0; } } return $p; @@ -5404,7 +5404,6 @@ function mep_add_cart_btn_icon($event_id){ $button = apply_filters('mep_cart_icon',"",$event_id); - echo ''.$button.''; -} \ No newline at end of file +} \ No newline at end of file diff --git a/inc/template-prts/event_ticket_type_loop_list.php b/inc/template-prts/event_ticket_type_loop_list.php index a490d1c..806f42b 100644 --- a/inc/template-prts/event_ticket_type_loop_list.php +++ b/inc/template-prts/event_ticket_type_loop_list.php @@ -44,12 +44,12 @@ if (!function_exists('mep_event_ticket_type_loop_list_html')) { $ticket_type_qty = array_key_exists('option_qty_t',$field) ? $field['option_qty_t'] : 0; $ticket_type_price = array_key_exists('option_price_t',$field) ? $field['option_price_t'] : 0; $qty_t_type = $ticket_type; - $total_quantity = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0; - $ticket_details = isset($field['option_details_t']) ? $field['option_details_t'] : ''; + $total_quantity = array_key_exists('option_qty_t',$field) ? $field['option_qty_t'] : 0; + $ticket_details = array_key_exists('option_details_t',$field) ? esc_html($field['option_details_t']) : ''; $sale_start_datetime = apply_filters('mep_sale_start_datetime',date('Y-m-d H:i',strtotime(get_the_date('Y-m-d H:i:s',$post_id))),$post_id, $field); - $sale_end_datetime = isset($field['option_sale_end_date_t']) && !empty($field['option_sale_end_date_t']) ? date('Y-m-d H:i',strtotime($field['option_sale_end_date_t'])) : date('Y-m-d H:i',strtotime($event_expire_date)); - $default_qty = isset($field['option_default_qty_t']) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0; - $total_resv_quantity = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0; + $sale_end_datetime = array_key_exists('option_sale_end_date_t',$field) && !empty($field['option_sale_end_date_t']) ? date('Y-m-d H:i',strtotime($field['option_sale_end_date_t'])) : date('Y-m-d H:i',strtotime($event_expire_date)); + $default_qty = array_key_exists('option_default_qty_t',$field) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0; + $total_resv_quantity = array_key_exists('option_rsv_t',$field) ? $field['option_rsv_t'] : 0; $event_date = get_post_meta($post_id, 'event_start_date', true) . ' ' . get_post_meta($post_id, 'event_start_time', true); $event_start_date = get_post_meta($post_id, 'event_start_date', true) . ' ' . get_post_meta($post_id, 'event_start_time', true);