diff --git a/inc/admin_setting_panel.php b/inc/admin_setting_panel.php index bdc97f3..470931f 100644 --- a/inc/admin_setting_panel.php +++ b/inc/admin_setting_panel.php @@ -129,7 +129,18 @@ class MAGE_Events_Setting_Controls { '12' => '12 Hour', '24' => '24 Hour' ) - ) + ), + array( + 'name' => 'mep_event_direct_checkout', + 'label' => __( 'Redirect Checkout after Booking?', 'mage-eventpress' ), + 'desc' => __( 'If you want to go direct checkout page after booking an event please enable/disable this.', 'mage-eventpress' ), + 'type' => 'select', + 'default' => 'yes', + 'options' => array( + 'yes' => 'Enable', + 'no' => 'Disable' + ) + ) ), 'email_setting_sec' => array( diff --git a/inc/mep_addon_list.php b/inc/mep_addon_list.php new file mode 100644 index 0000000..230b8d5 --- /dev/null +++ b/inc/mep_addon_list.php @@ -0,0 +1,146 @@ +Get Addons','mage-eventpress'), 'manage_options', 'mep_all_addon_list', 'mep_addon_list_sec'); +} + +function mep_addon_list_sec(){ + +?> + + 'WooCommerce Event Booking Manager PRO', + 'price' => '$30', + 'banner' => 'https://mage-people.com/wp-content/uploads/2018/06/banner_EVENT.png', + 'url' => 'https://mage-people.com/product/mage-woo-event-booking-manager-pro/', + 'excerpt' => 'A Complete Event Solution forWooCommerce with Lots of Premium features Powered by WordPress', + 'btn_txt' => 'Get Now' + ), + array( + 'name' => 'WooCommerce Event Coupon Code Addon', + 'price' => '$10', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/02/banner_EVENT_Coupon.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-coupon-code-addon/', + 'excerpt' => 'WooCommerce Event Manager is a great solution managing events and this is a simple solution for managing coupon code for specific events to specific customer', + 'btn_txt' => 'Get Now' + ), + + array( + 'name' => 'WooCommerce Event Waitlist Addon', + 'price' => '$10', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/02/banner_WaitList.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-waitlist-addon/', + 'excerpt' => 'WooCommerce Event Waitlist Addon, It will work with Event plugin, Once event ticket available quantity will finish, Waitlist plugin will be activated and the subscriber can join the waitlist, admin can send email to the user for next free slot.', + 'btn_txt' => 'Get Now' + ), + + array( + 'name' => 'WooCommerce Event Waitlist Addon', + 'price' => '$20', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/03/banner_EVENT_calender-800x473.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-calendar-addon/', + 'excerpt' => 'Showcase your events into an awesome calendar by this Addon. Just installed this plugin and use the shortcode to show the calendar anywhere in your website.', + 'btn_txt' => 'Get Now' + ), + + array( + 'name' => 'WooCommerce Event: Book an Event From Dashboard', + 'price' => '$20', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/03/banner_EVENT_order_dashboard-800x473.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-book-an-event-from-dashboard/', + 'excerpt' => 'This addon will add a new feature so you can book any event from the WordPress Dashboard.', + 'btn_txt' => 'Get Now' + ), + array( + 'name' => 'Woocommerce Event: User Registration Form Position', + 'price' => '$10', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/03/banner_EVENT_user_reg-800x473.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-user-registration-form-position/', + 'excerpt' => 'This addon adds this feature, You can choose where the event Attendee/user form will display into the event details page or into the checkout page', + 'btn_txt' => 'Get Now' + ), + array( + 'name' => 'Woocommerce Event: Duplicator Addon', + 'price' => '$5', + 'banner' => 'https://mage-people.com/wp-content/uploads/2019/03/banner_EVENT_duplicator-1-800x473.png', + 'url' => 'https://mage-people.com/product/woocommerce-event-duplicator-addon/', + 'excerpt' => 'This addon will add Duplicator feature into Woocommerce Event Plugin. So you can easily duplicate any event and re-use.', + 'btn_txt' => 'Get Now' + ) + +); + + + + +echo '
'; +} \ No newline at end of file diff --git a/inc/mep_event_meta.php b/inc/mep_event_meta.php index 034cbe6..1024514 100644 --- a/inc/mep_event_meta.php +++ b/inc/mep_event_meta.php @@ -2,34 +2,37 @@ if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly. add_action( 'add_meta_boxes', 'mep_event_meta_box_add' ); function mep_event_meta_box_add(){ + add_meta_box( 'mep-event-meta', __('Event Venue','mage-eventpress'), 'mep_event_venue_meta_box_cb', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-price', __('Event Price (Event Base price, It will not work if you add Event Ticket type Price)','mage-eventpress'), 'mep_event_price_meta_box_cb', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-extra-price', __('Event Extra Service (Extra Service as Product that you can sell and it is not included on event package)','mage-eventpress'), 'mep_event_extra_price_option', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-ticket-type', __('Event Ticket Type','mage-eventpress'), 'mep_event_ticket_type', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-date', __('Event Date & Time','mage-eventpress'), 'mep_event_date_meta_box_cb', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-emails', __('Event Email text','mage-eventpress'), 'mep_event_email_meta_box_cb', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-template', __('Template','mage-eventpress'), 'mep_event_template_meta_box_cb', 'mep_events', 'side', 'low' ); - add_meta_box( 'mep-event-faq-box', __('Event F.A.Q','mage-eventpress'), 'mep_event_faq_meta_box_cb', 'mep_events', 'normal', 'high' ); - add_meta_box( 'mep-event-reg-on-off', __('Registration Status','mage-eventpress'), 'mep_event_change_reg_status_cb', 'mep_events', 'side', 'low' ); - - add_meta_box( 'mep-event-available-set-on-off', __('Show Available Seat Count?','mage-eventpress'), 'mep_event_available_seat_cb', 'mep_events', 'side', 'low' ); - - - add_meta_box( 'mep-event-day-details', __('Event Daywise Details','mage-eventpress'), 'mep_event_day_details_cb', 'mep_events', 'normal', 'high' ); + add_meta_box( 'mep-event-reg-on-off', __('Registration Status','mage-eventpress'), 'mep_event_change_reg_status_cb', 'mep_events', 'side', 'low' ); + add_meta_box( 'mep-event-available-set-on-off', __('Show Available Seat Count?','mage-eventpress'), 'mep_event_available_seat_cb', 'mep_events', 'side', 'low' ); + add_meta_box( 'mep-event-day-details', __('Event Daywise Details','mage-eventpress'), 'mep_event_day_details_cb', 'mep_events', 'normal', 'high' ); } function mep_event_change_reg_status_cb($post){ @@ -1144,12 +1147,6 @@ elseif ( empty($mdate) && $oldm ) - - - - - - $update_reg_name = update_post_meta( $pid, 'mep_full_name', $mep_full_name); $update_reg_email = update_post_meta( $pid, 'mep_reg_email', $mep_reg_email); $update_reg_phone = update_post_meta( $pid, 'mep_reg_phone', $mep_reg_phone); @@ -1330,9 +1327,9 @@ $event_meta = get_post_custom($values['ea_event_id'][0]); $mep_form_builder_data = get_post_meta($values['ea_event_id'][0], 'mep_form_builder_data', true); if ( $mep_form_builder_data ) { foreach ( $mep_form_builder_data as $_field ) { - if ( $mep_user_ticket_type[$iu] != '' ) : - $user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) ); - endif; + // if ( $mep_user_ticket_type[$iu] != '' ) : + // $user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) ); + // endif; ?>
diff --git a/inc/mep_extra_price.php b/inc/mep_extra_price.php index ba9d19d..e2512f2 100644 --- a/inc/mep_extra_price.php +++ b/inc/mep_extra_price.php @@ -1,194 +1,72 @@ "; ?>
  • :
  • -
  • :
  • +
  • :
  • 0){ ?> @@ -253,17 +133,25 @@ add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', function mep_add_custom_fields_text_to_order_items( $item, $cart_item_key, $values, $order ) { -$eid = $values['event_id']; +$eid = $values['event_id']; if (get_post_type($eid) == 'mep_events') { $mep_events_extra_prices = $values['event_extra_option']; -$event_user_info = $values['event_user_info']; $event_ticket_type = $values['event_ticket_type']; $event_ticket_price = $values['event_ticket_price']; $event_ticket_qty = $values['event_ticket_qty']; $product_id = $values['product_id']; - $cart_location = $values['event_cart_location']; $cart_date = $values['event_cart_date']; +$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' ); + + if($form_position=='details_page'){ + $event_user_info = $values['event_user_info']; + }else{ + $event_user_info = mep_save_attendee_info_into_cart($eid); + } + + + $item->add_meta_data('Date',$cart_date); $item->add_meta_data('Location',$cart_location); @@ -299,17 +187,15 @@ $tck_name = $product_id.str_replace(' ', '', $event_ticket_type); $tesqt = get_post_meta($product_id,"mep_xtra_$tck_name",true); $ntesqt = ($tesqt+$event_ticket_qty); update_post_meta( $product_id, "mep_xtra_$tck_name",$ntesqt); -$item->add_meta_data('event_ticket_type','ticket_typs'); +$item->add_meta_data('_event_ticket_type','ticket_typs'); }else{ - $item->add_meta_data('event_ticket_type','normal'); + $item->add_meta_data('_event_ticket_type','normal'); } - $item->add_meta_data('_event_user_info',$event_user_info); +$item->add_meta_data('_no_of_ticket',count($event_user_info)); $item->add_meta_data('_event_service_info',$mep_events_extra_prices); $item->add_meta_data('event_id',$eid); -$item->add_meta_data('no_of_ticket',count($event_user_info)); - } } diff --git a/inc/mep_shortcode.php b/inc/mep_shortcode.php index c0f7eec..2a45c71 100644 --- a/inc/mep_shortcode.php +++ b/inc/mep_shortcode.php @@ -216,22 +216,16 @@ $author_terms = get_the_terms(get_the_id(), 'mep_org'); ?>
    - -
    - - -
    - -

    +

    @@ -544,5 +538,4 @@ if($pagination=='yes'){ +

    -
    + +

    +
    + + + + + + + + @@ -129,9 +140,8 @@ $values = get_post_custom(get_the_id()); $mep_form_builder_data = get_post_meta($values['ea_event_id'][0], 'mep_form_builder_data', true); if ( $mep_form_builder_data ) { foreach ( $mep_form_builder_data as $_field ) { - if ( $mep_user_ticket_type[$iu] != '' ) : - $user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) ); - endif; + + $vname = "ea_".$_field['mep_fbc_id']; $vals = $values[$vname][0]; if($vals){ diff --git a/woocommerce-event-press.php b/woocommerce-event-press.php index 2a91f15..9ccfa2f 100644 --- a/woocommerce-event-press.php +++ b/woocommerce-event-press.php @@ -3,7 +3,7 @@ * Plugin Name: Woocommerce Events Manager * Plugin URI: http://mage-people.com * Description: A Complete Event Solution for WordPress by MagePeople.. -* Version: 2.4.1 +* Version: 2.5.0 * Author: MagePeople Team * Author URI: http://www.mage-people.com/ * Text Domain: mage-eventpress @@ -25,6 +25,7 @@ require_once(dirname(__FILE__) . "/lib/PHPExcel.php"); require_once(dirname(__FILE__) . "/inc/mep_csv_export.php"); require_once(dirname(__FILE__) . "/inc/mep_user_custom_style.php"); require_once(dirname(__FILE__) . "/inc/mep_tax_meta.php"); +require_once(dirname(__FILE__) . "/inc/mep_addon_list.php"); // Language Load add_action( 'init', 'mep_language_load'); @@ -175,7 +176,7 @@ function mep_event_get_order_meta($item_id,$key){ global $wpdb; $table_name = $wpdb->prefix."woocommerce_order_itemmeta"; $sql = 'SELECT meta_value FROM '.$table_name.' WHERE order_item_id ='.$item_id.' AND meta_key="'.$key.'"'; - $results = $wpdb->get_results($sql); + $results = $wpdb->get_results($sql); //or die(mysql_error()); foreach( $results as $result ) { $value = $result->meta_value; } @@ -248,7 +249,7 @@ $result = $wpdb->get_results( "SELECT * FROM $table_name WHERE order_item_id=$it // if($order->has_status( 'processing' ) || $order->has_status( 'pending' )) { -if($order->has_status( 'processing' ) || $order->has_status( 'completed' )) { +if($order->has_status( 'processing' ) || $order->has_status( 'pending' )) { // update_post_meta( $event_id, $mep_atnd, "a2"); $mep_stock_msgc = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0); @@ -268,15 +269,11 @@ if($mep_stock_orderc==$order_id){ update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes); } } - - - } } update_post_meta( $event_id, $order_meta_text, $order_processing); - $mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0); $mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1); @@ -290,11 +287,7 @@ if($mep_stock_order==$order_id){ update_post_meta( $event_id, $order_meta_text, $order_processing); } - } - - - - + } } @@ -345,7 +338,7 @@ update_post_meta( $event_id, $mep_atnd, "a2"); update_post_meta( $event_id, $order_meta_text, $order_completed); } else{ - update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity)); + // update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity)); update_post_meta( $event_id, $order_meta_text, $order_completed); foreach ( $result as $page ){ @@ -477,8 +470,11 @@ function mep_get_event_status($startdatetime){ add_filter ('woocommerce_add_to_cart_redirect', 'mep_event_redirect_to_checkout'); function mep_event_redirect_to_checkout() { global $woocommerce; + $redirect_status = mep_get_option( 'mep_event_direct_checkout', 'general_setting_sec', 'yes' ); + if($redirect_status=='yes'){ $checkout_url = wc_get_checkout_url(); return $checkout_url; + } } @@ -891,7 +887,7 @@ $org_id = $org_arr[0]->term_id; } } - + function mep_get_total_available_seat($event_id, $event_meta){ $book_count = get_post_meta(get_the_id(),'total_booking', true); @@ -1031,4 +1027,119 @@ if($item_name=='mep_country'){ } -} \ No newline at end of file +} + +function mep_save_attendee_info_into_cart($product_id){ + + $user = array(); + + if(isset($_POST['user_name'])){ + $mep_user_name = $_POST['user_name']; + }else{ $mep_user_name=""; } + + if(isset($_POST['user_email'])){ + $mep_user_email = $_POST['user_email']; + }else{ $mep_user_email=""; } + + if(isset($_POST['user_phone'])){ + $mep_user_phone = $_POST['user_phone']; + }else{ $mep_user_phone=""; } + + if(isset($_POST['user_address'])){ + $mep_user_address = $_POST['user_address']; + }else{ $mep_user_address=""; } + + if(isset($_POST['gender'])){ + $mep_user_gender = $_POST['gender']; + }else{ $mep_user_gender=""; } + + if(isset($_POST['tshirtsize'])){ + $mep_user_tshirtsize = $_POST['tshirtsize']; + }else{ $mep_user_tshirtsize=""; } + + if(isset($_POST['user_company'])){ + $mep_user_company = $_POST['user_company']; + }else{ $mep_user_company=""; } + + if(isset($_POST['user_designation'])){ + $mep_user_desg = $_POST['user_designation']; + }else{ $mep_user_desg=""; } + + if(isset($_POST['user_website'])){ + $mep_user_website = $_POST['user_website']; + }else{ $mep_user_website=""; } + + if(isset($_POST['vegetarian'])){ + $mep_user_vegetarian = $_POST['vegetarian']; + }else{ $mep_user_vegetarian=""; } + + if(isset($_POST['ticket_type'])){ + $mep_user_ticket_type = $_POST['ticket_type']; + }else{ $mep_user_ticket_type=""; } + + if(isset($_POST['mep_ucf'])){ + $mep_user_cfd = $_POST['mep_ucf']; + }else{ + $mep_user_cfd = ""; + } + + $count_user = count($mep_user_name); + + for ( $iu = 0; $iu < $count_user; $iu++ ) { + + if ( $mep_user_name[$iu] != '' ) : + $user[$iu]['user_name'] = stripslashes( strip_tags( $mep_user_name[$iu] ) ); + endif; + + if ( $mep_user_email[$iu] != '' ) : + $user[$iu]['user_email'] = stripslashes( strip_tags( $mep_user_email[$iu] ) ); + endif; + + if ( $mep_user_phone[$iu] != '' ) : + $user[$iu]['user_phone'] = stripslashes( strip_tags( $mep_user_phone[$iu] ) ); + endif; + + if ( $mep_user_address[$iu] != '' ) : + $user[$iu]['user_address'] = stripslashes( strip_tags( $mep_user_address[$iu] ) ); + endif; + + if ( $mep_user_gender[$iu] != '' ) : + $user[$iu]['user_gender'] = stripslashes( strip_tags( $mep_user_gender[$iu] ) ); + endif; + + if ( $mep_user_tshirtsize[$iu] != '' ) : + $user[$iu]['user_tshirtsize'] = stripslashes( strip_tags( $mep_user_tshirtsize[$iu] ) ); + endif; + + if ( $mep_user_company[$iu] != '' ) : + $user[$iu]['user_company'] = stripslashes( strip_tags( $mep_user_company[$iu] ) ); + endif; + + if ( $mep_user_desg[$iu] != '' ) : + $user[$iu]['user_designation'] = stripslashes( strip_tags( $mep_user_desg[$iu] ) ); + endif; + + if ( $mep_user_website[$iu] != '' ) : + $user[$iu]['user_website'] = stripslashes( strip_tags( $mep_user_website[$iu] ) ); + endif; + + if ( $mep_user_vegetarian[$iu] != '' ) : + $user[$iu]['user_vegetarian'] = stripslashes( strip_tags( $mep_user_vegetarian[$iu] ) ); + endif; + + if ( $mep_user_ticket_type[$iu] != '' ) : + $user[$iu]['user_ticket_type'] = stripslashes( strip_tags( $mep_user_ticket_type[$iu] ) ); + endif; + + $mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true); + if ( $mep_form_builder_data ) { + foreach ( $mep_form_builder_data as $_field ) { + $user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) ); + } + } + } + return $user; +} + + +