diff --git a/css/style.css b/css/style.css index 6a310be..54dccf5 100644 --- a/css/style.css +++ b/css/style.css @@ -372,7 +372,14 @@ button.single_add_to_cart_button.button.alt.btn-mep-event-cart { cursor: pointer font-size: 70px!important; } - +.mep-wailist-form input { + display: block; + overflow: hidden; + margin: 20px auto!important; + width: 100%; + padding: 10px!important; + background: #fff!important; +} /* Minimal Styles */ .mep_event_minimal_list { diff --git a/inc/mep_extra_price.php b/inc/mep_extra_price.php index 3a2782b..97339b6 100644 --- a/inc/mep_extra_price.php +++ b/inc/mep_extra_price.php @@ -38,7 +38,7 @@ function mep_add_custom_fields_text_to_cart_item($cart_item_data, $product_id, $ // echo '
';
-// print_r($user);
+// // print_r($user);
 // print_r($ticket_type_arr);
 // die();
 
@@ -152,11 +152,12 @@ $hide_date_status  = mep_get_option('mep_hide_date_from_order_page', 'general_se
    0) {
-      echo mep_cart_display_ticket_type_list($ticket_type_arr);
+      // echo $eid;
+      echo mep_cart_display_ticket_type_list($ticket_type_arr, $eid);
     }
     if (is_array($event_extra_service) && sizeof($event_extra_service) > 0) {
       foreach ($event_extra_service as $extra_service) {
-        echo '
  • ' . $extra_service['service_name'] . " - " . wc_price($extra_service['service_price']) . ' x ' . $extra_service['service_qty'] . ' = ' . wc_price( (int) $extra_service['service_price'] * (int) $extra_service['service_qty']) . '
  • '; + echo '
  • ' . $extra_service['service_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$extra_service['service_price'])) . ' x ' . $extra_service['service_qty'] . ' = ' . wc_price( mep_get_price_including_tax($eid,(int) $extra_service['service_price'] * (int) $extra_service['service_qty'])) . '
  • '; } } do_action('mep_after_cart_item_display_list',$cart_item); @@ -232,14 +233,14 @@ function mep_add_custom_fields_text_to_order_items($item, $cart_item_key, $value if (is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0) { - mep_cart_order_data_save_ticket_type($item,$ticket_type_arr); + mep_cart_order_data_save_ticket_type($item,$ticket_type_arr,$eid); } if (is_array($event_extra_service) && sizeof($event_extra_service) > 0) { foreach ($event_extra_service as $extra_service) { - $service_type_name = $extra_service['service_name'] . " - " . wc_price($extra_service['service_price']) . ' x ' . $extra_service['service_qty'] . ' = '; - $service_type_val = wc_price($extra_service['service_price'] * $extra_service['service_qty']); + $service_type_name = $extra_service['service_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$extra_service['service_price'])) . ' x ' . $extra_service['service_qty'] . ' = '; + $service_type_val = wc_price(mep_get_price_including_tax($eid,$extra_service['service_price'] * $extra_service['service_qty'])); $item->add_meta_data($service_type_name, $service_type_val); } } diff --git a/inc/mep_file_include.php b/inc/mep_file_include.php index 2d3db2b..dea3595 100755 --- a/inc/mep_file_include.php +++ b/inc/mep_file_include.php @@ -22,4 +22,5 @@ require_once(dirname(__DIR__) . "/inc/mep_tax_meta.php"); // require_once(dirname(__DIR__) . "/inc/mep_addon_list.php"); require_once(dirname(__DIR__) . "/inc/mep_upgrade.php"); require_once(dirname(__DIR__) . "/inc/mep_functions.php"); -require_once(dirname(__DIR__) . "/inc/mep_query.php"); \ No newline at end of file +require_once(dirname(__DIR__) . "/inc/mep_query.php"); +// require_once(dirname(__DIR__) . "/support/elementor/elementor-support.php"); \ No newline at end of file diff --git a/inc/mep_functions.php b/inc/mep_functions.php index bc06177..33891ec 100755 --- a/inc/mep_functions.php +++ b/inc/mep_functions.php @@ -402,6 +402,7 @@ $ticket_total_price = (mep_get_event_ticket_price_by_name($event_id,$ticket_type update_post_meta( $pid, 'ea_event_id', $event_id ); update_post_meta( $pid, 'ea_order_id', $order_id ); update_post_meta( $pid, 'ea_user_id', $user_id ); + update_post_meta( $pid, 'mep_checkin', 'No' ); update_post_meta( $order_id, 'ea_user_id', $user_id ); update_post_meta( $order_id, 'order_type_name', 'mep_events' ); update_post_meta( $pid, 'ea_ticket_no', $pin ); @@ -1836,7 +1837,7 @@ if (!function_exists('mep_get_term_as_class')) { if($tt){ $t_class = array(); foreach($tt as $tclass){ - $t_class[] = 'mage-'.$tclass->slug; + $t_class[] = 'mage-'.$tclass->term_id; } $main_class = implode(' ',$t_class); return $main_class; @@ -2741,22 +2742,22 @@ function mep_cart_display_user_list($user_info){ if (!function_exists('mep_cart_display_ticket_type_list')) { -function mep_cart_display_ticket_type_list($ticket_type_arr){ +function mep_cart_display_ticket_type_list($ticket_type_arr,$eid){ ob_start(); foreach ($ticket_type_arr as $ticket) { - echo '
  • ' . $ticket['ticket_name'] . " - " . wc_price($ticket['ticket_price']) . ' x ' . $ticket['ticket_qty'] . ' = ' . wc_price((float) $ticket['ticket_price'] * (float) $ticket['ticket_qty']) . '
  • '; + echo '
  • ' . $ticket['ticket_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$ticket['ticket_price'])) . ' x ' . $ticket['ticket_qty'] . ' = ' . wc_price(mep_get_price_including_tax($eid, (float) $ticket['ticket_price'] * (float) $ticket['ticket_qty'])) . '
  • '; } - return apply_filters('mep_display_ticket_in_cart_list',ob_get_clean(),$ticket_type_arr); + return apply_filters('mep_display_ticket_in_cart_list',ob_get_clean(),$ticket_type_arr,$eid); } } if (!function_exists('mep_cart_order_data_save_ticket_type')) { -function mep_cart_order_data_save_ticket_type($item,$ticket_type_arr){ +function mep_cart_order_data_save_ticket_type($item,$ticket_type_arr,$eid){ foreach ($ticket_type_arr as $ticket) { - $ticket_type_name = $ticket['ticket_name'] . " - " . wc_price($ticket['ticket_price']) . ' x ' . $ticket['ticket_qty'] . ' = '; - $ticket_type_val = wc_price($ticket['ticket_price'] * $ticket['ticket_qty']); + $ticket_type_name = $ticket['ticket_name'] . " - " . wc_price(mep_get_price_including_tax($eid,$ticket['ticket_price'])) . ' x ' . $ticket['ticket_qty'] . ' = '; + $ticket_type_val = wc_price(mep_get_price_including_tax($eid,$ticket['ticket_price'] * $ticket['ticket_qty'])); $ticket_name_meta = apply_filters('mep_event_order_meta_ticket_name_filter',$ticket_type_name,$ticket); $item->add_meta_data($ticket_name_meta, $ticket_type_val); } @@ -2792,7 +2793,7 @@ function mep_single_page_js_script($event_id){ jQuery(document).ready(function() { - 0){ ?> + 0 && !is_admin() ){ ?> jQuery("#mep-event-accordion").accordion({ collapsible: true, active: false @@ -2974,18 +2975,18 @@ if (!function_exists('mep_get_event_dates_arr')) { if(sizeof($event_more_dates) > 0){ $i=0; foreach ($event_more_dates as $mdate) { - if(strtotime($now) < strtotime($mdate['event_more_start_date'].' '.$mdate['event_more_start_time'])){ + // if(strtotime($now) < strtotime($mdate['event_more_start_date'].' '.$mdate['event_more_start_time'])){ $mstart = $mdate['event_more_start_date'].' '.$mdate['event_more_start_time']; $mend = $mdate['event_more_end_date'].' '.$mdate['event_more_end_time']; $m_date_arr[$i]['start'] = $mstart; $m_date_arr[$i]['end'] = $mend; - } + // } $i++; } } $event_dates = array_merge($date_arr,$m_date_arr); -// print_r($event_dates); + return apply_filters('mep_event_dates_in_calender_free',$event_dates,$event_id); } @@ -3013,4 +3014,129 @@ if (!function_exists('mep_get_events_custom_meta_for_api')) { return $post_meta; } +} + + + + + +function mep_elementor_get_tax_term( $tax ) { + $terms = get_terms( array( + 'taxonomy' => $tax, + 'hide_empty' => false, + ) ); + + $list = array( '0' => __( 'Show All', '' ) ); + + foreach ( $terms as $_term ) { + $list[ $_term->term_id ] = $_term->name; + } + + return $list; +} + + + + +// add_action('init','price_test'); + +function price_test(){ + echo mep_get_price_including_tax( 408, 100); + die(); +} + + +function mep_get_price_including_tax( $event, $price, $args = array() ) { + + $args = wp_parse_args( + $args, + array( + 'qty' => '', + 'price' => '', + ) + ); + + $_product = get_post_meta($event, 'link_wc_product', true) ? get_post_meta($event, 'link_wc_product', true) : $event; + // $price = '' !== $args['price'] ? max( 0.0, (float) $args['price'] ) : $product->get_price(); + $qty = '' !== $args['qty'] ? max( 0.0, (float) $args['qty'] ) : 1; + $product = wc_get_product( $_product ); + + if ( '' === $price ) { + return ''; + } elseif ( empty( $qty ) ) { + return 0.0; + } + + $line_price = $price * $qty; + $return_price = $line_price; + + if ( $product->is_taxable() ) { + + + + + + if ( ! wc_prices_include_tax() ) { + + $tax_rates = WC_Tax::get_rates( $product->get_tax_class() ); + $taxes = WC_Tax::calc_tax( $line_price, $tax_rates, false ); + + if ( 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ) ) { + $taxes_total = array_sum( $taxes ); + } else { + $taxes_total = array_sum( array_map( 'wc_round_tax_total', $taxes ) ); + } + + $return_price = round( $line_price, wc_get_price_decimals() ); + } else { + + + // print_r($product); + + $tax_rates = WC_Tax::get_rates( $product->get_tax_class() ); + $base_tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class( 'unfiltered' ) ); + + +// print_r($base_tax_rates); + + + /** + * If the customer is excempt from VAT, remove the taxes here. + * Either remove the base or the user taxes depending on woocommerce_adjust_non_base_location_prices setting. + */ + if ( ! empty( WC()->customer ) && WC()->customer->get_is_vat_exempt() ) { // @codingStandardsIgnoreLine. + $remove_taxes = apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ? WC_Tax::calc_tax( $line_price, $base_tax_rates, true ) : WC_Tax::calc_tax( $line_price, $tax_rates, true ); + + if ( 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ) ) { + $remove_taxes_total = array_sum( $remove_taxes ); + } else { + $remove_taxes_total = array_sum( array_map( 'wc_round_tax_total', $remove_taxes ) ); + } + + $return_price = round( $line_price, wc_get_price_decimals() ); + + /** + * The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations. + * e.g. If a product costs 10 including tax, all users will pay 10 regardless of location and taxes. + * This feature is experimental @since 2.4.7 and may change in the future. Use at your risk. + */ + } else{ + $base_taxes = WC_Tax::calc_tax( $line_price, $base_tax_rates, true ); + $modded_taxes = WC_Tax::calc_tax( $line_price - array_sum( $base_taxes ), $tax_rates, false ); + + if ( 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' ) ) { + $base_taxes_total = array_sum( $base_taxes ); + $modded_taxes_total = array_sum( $modded_taxes ); + } else { + $base_taxes_total = array_sum( array_map( 'wc_round_tax_total', $base_taxes ) ); + $modded_taxes_total = array_sum( array_map( 'wc_round_tax_total', $modded_taxes ) ); + } + $return_price = round( $line_price - $base_taxes_total , wc_get_price_decimals() ); + } + + + + } + } + return apply_filters( 'woocommerce_get_price_including_tax', $return_price, $qty, $product ); } \ No newline at end of file diff --git a/inc/mep_shortcode.php b/inc/mep_shortcode.php index 17f0a02..27d1a52 100644 --- a/inc/mep_shortcode.php +++ b/inc/mep_shortcode.php @@ -134,13 +134,13 @@ function mep_event_list($atts, $content = null) /** * This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File */ - do_action('mep_event_list_cat_names'); + do_action('mep_event_list_cat_names',$cat); } if ($org_f == 'yes') { /** * This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File */ - do_action('mep_event_list_org_names'); + do_action('mep_event_list_org_names',$org); } ?>
    @@ -281,13 +281,13 @@ function mep_expire_event_list($atts, $content = null) /** * This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File */ - do_action('mep_event_list_cat_names'); + do_action('mep_event_list_cat_names',$cat); } if ($org_f == 'yes') { /** * This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File */ - do_action('mep_event_list_org_names'); + do_action('mep_event_list_org_names',$org); } ?>
    "0", - "org" => "0", - "style" => "grid", - "cat-filter" => "no", - "org-filter" => "no", - "show" => "-1", - "pagination" => "no", - 'sort' => 'ASC' + "cat" => "0", + "org" => "0", + "style" => "grid", + "column" => 3, + "cat-filter" => "no", + "org-filter" => "no", + "show" => "-1", + "pagination" => "no", + "city" => "", + "country" => "", + "carousal-nav" => "no", + "carousal-dots" => "yes", + "carousal-id" => "102448", + "timeline-mode" => "vertical", + 'sort' => 'ASC', + 'status' => 'upcoming' ); + $params = shortcode_atts($defaults, $atts); + $cat = $params['cat']; + $org = $params['org']; + $style = $params['style']; + $cat_f = $params['cat-filter']; + $org_f = $params['org-filter']; + $show = $params['show']; + $pagination = $params['pagination']; + $sort = $params['sort']; + $column = $style != 'grid' ? 1 : $params['column']; + $nav = $params['carousal-nav'] == 'yes' ? 1 : 0; + $dot = $params['carousal-dots'] == 'yes' ? 1 : 0; + $city = $params['city']; + $country = $params['country']; + $cid = $params['carousal-id']; + $status = $params['status']; + $main_div = $pagination == 'carousal' ? '