diff --git a/inc/admin_setting_panel.php b/inc/admin_setting_panel.php index 78aab27..31f015b 100644 --- a/inc/admin_setting_panel.php +++ b/inc/admin_setting_panel.php @@ -241,6 +241,13 @@ if (!class_exists('MAGE_Events_Setting_Controls')) : 'type' => 'text', 'default' => 'Price Starts from:' ), + array( + 'name' => 'event_price_label_single', + 'label' => __('Event Price Label For Single Price', 'mage-eventpress'), + 'desc' => __('Enter The text which you want to show as price label For Single Price, Its only displayed if Show Event price value is YES above. ', 'mage-eventpress'), + 'type' => 'text', + 'default' => 'Price:' + ), array( 'name' => 'mep_event_time_format', 'label' => __('Event Time Format', 'mage-eventpress'), diff --git a/inc/mep_functions.php b/inc/mep_functions.php index 3266f72..edc8b93 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -1653,25 +1653,20 @@ if (!function_exists('mep_get_tshirts_sizes')) { if (!function_exists('mep_event_list_price')) { - function mep_event_list_price($pid) { + function mep_event_list_price($pid, $type='price') { global $post; - $cur = get_woocommerce_currency_symbol(); - $mep_event_ticket_type = get_post_meta($pid, 'mep_event_ticket_type', true); - $mep_events_extra_prices = get_post_meta($pid, 'mep_events_extra_prices', true); - $n_price = get_post_meta($pid, '_price', true); + $cur = get_woocommerce_currency_symbol(); + $mep_event_ticket_type = get_post_meta($pid, 'mep_event_ticket_type', true) ? get_post_meta($pid, 'mep_event_ticket_type', true) : []; + $n_price = get_post_meta($pid, '_price', true); + $price_arr = []; - if ($n_price == 0) { - $gn_price = "Free"; - } else { - $gn_price = wc_price($n_price); + if(sizeof($mep_event_ticket_type) > 0){ + foreach ($mep_event_ticket_type as $ticket) { + $price_arr[] = $ticket['option_price_t']; + } } - - if ($mep_event_ticket_type) { - $gn_price = wc_price($mep_event_ticket_type[0]['option_price_t']); - } - - return $gn_price; + return $type == 'price' ? wc_price(min($price_arr)) : count($price_arr); } } diff --git a/inc/template-prts/event_loop_list.php b/inc/template-prts/event_loop_list.php index 58250db..de98ef1 100644 --- a/inc/template-prts/event_loop_list.php +++ b/inc/template-prts/event_loop_list.php @@ -9,7 +9,10 @@ if (!function_exists('mep_display_event_loop_list')) { { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + // event_price_label_single + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org') ? get_the_terms($event_id, 'mep_org') : []; $time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); @@ -20,6 +23,7 @@ if (!function_exists('mep_display_event_loop_list')) { $cat_class = mep_get_term_as_class($event_id, 'mep_cat',$unq_id); $event_multidate = array_key_exists('mep_event_more_date', $event_meta) ? maybe_unserialize($event_meta['mep_event_more_date'][0]) : array(); $available_seat = mep_get_total_available_seat($event_id, $event_meta); + // $available_seat = 1; $hide_org_list = mep_get_option('mep_event_hide_organizer_list', 'general_setting_sec', 'no'); $hide_location_list = mep_get_option('mep_event_hide_location_list', 'general_setting_sec', 'no'); $hide_time_list = mep_get_option('mep_event_hide_time_list', 'general_setting_sec', 'no'); diff --git a/inc/template-prts/event_loop_minimal.php b/inc/template-prts/event_loop_minimal.php index 5ed2a1c..1dc06bf 100644 --- a/inc/template-prts/event_loop_minimal.php +++ b/inc/template-prts/event_loop_minimal.php @@ -14,7 +14,9 @@ if (!function_exists('mep_event_loop_minimal_style')) { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); diff --git a/inc/template-prts/event_loop_native.php b/inc/template-prts/event_loop_native.php index e917c43..1997e50 100644 --- a/inc/template-prts/event_loop_native.php +++ b/inc/template-prts/event_loop_native.php @@ -14,7 +14,9 @@ if (!function_exists('mep_event_loop_native_style')) { if ($style == 'native') { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); diff --git a/inc/template-prts/event_loop_spring.php b/inc/template-prts/event_loop_spring.php index b3001aa..4fbd88e 100644 --- a/inc/template-prts/event_loop_spring.php +++ b/inc/template-prts/event_loop_spring.php @@ -15,7 +15,9 @@ if (!function_exists('mep_event_loop_spring_style')) { if ($style == 'spring') { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $start_time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); diff --git a/inc/template-prts/event_loop_timeline.php b/inc/template-prts/event_loop_timeline.php index 3bd10b9..69c1c90 100644 --- a/inc/template-prts/event_loop_timeline.php +++ b/inc/template-prts/event_loop_timeline.php @@ -14,7 +14,9 @@ if (!function_exists('mep_event_loop_timeline_style')) { if ($style == 'timeline') { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); diff --git a/inc/template-prts/event_loop_title.php b/inc/template-prts/event_loop_title.php index e05ee6c..6f2fc24 100644 --- a/inc/template-prts/event_loop_title.php +++ b/inc/template-prts/event_loop_title.php @@ -15,7 +15,9 @@ if (!function_exists('mep_event_loop_title_style')) { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]); diff --git a/inc/template-prts/event_loop_winter.php b/inc/template-prts/event_loop_winter.php index dda37d9..cec20b9 100644 --- a/inc/template-prts/event_loop_winter.php +++ b/inc/template-prts/event_loop_winter.php @@ -15,7 +15,9 @@ if (!function_exists('mep_event_loop_winter_style')) { if ($style == 'winter') { $now = current_time('Y-m-d H:i:s'); $show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes'); - $show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:'); + $price_count = mep_event_list_price($event_id, 'count'); + $show_price_label = $price_count == 1 ? mep_get_option('event_price_label_single', 'general_setting_sec', __('Price:','mage-eventpress')) : mep_get_option('event-price-label', 'general_setting_sec', __('Price Starts from:','mage-eventpress')); + $event_meta = get_post_custom($event_id); $author_terms = get_the_terms($event_id, 'mep_org'); $start_time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]);