Version 2.8.0 released

This commit is contained in:
magepeopleteam 2019-11-04 11:24:02 +00:00
parent 74062781a1
commit dfc796c2eb
9 changed files with 658 additions and 255 deletions

View File

@ -1479,6 +1479,16 @@ h4.mep-cart-table-title {
padding: 0 0 0 25px; padding: 0 0 0 25px;
} }
p#mep_btn_notice {
text-align: center;
width: 300px;
float: none;
margin: 0;
}
/* Responsive CSS /* Responsive CSS
=====================================================================*/ =====================================================================*/
@media only screen and (min-width: 768px) and (max-width: 990px) { @media only screen and (min-width: 768px) and (max-width: 990px) {

View File

@ -7,10 +7,10 @@ function mep_event_meta_box_add(){
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-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', __('<span class="dashicons dashicons-awards" style="color:green; padding-right:10px;"></span>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', __('<span class="dashicons dashicons-buddicons-tracking" style="color:green; padding-right:10px;"></span>Event Ticket Type and Pricing','mage-eventpress'), 'mep_event_ticket_type', 'mep_events', 'normal', 'high' ); add_meta_box( 'mep-event-ticket-type', __('<span class="dashicons dashicons-buddicons-tracking" style="color:green; padding-right:10px;"></span>Event Ticket Type and Pricing','mage-eventpress'), 'mep_event_ticket_type', 'mep_events', 'normal', 'high' );
add_meta_box( 'mep-event-extra-price', __('<span class="dashicons dashicons-awards" style="color:green; padding-right:10px;"></span>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-date', __('<span class="dashicons dashicons-calendar-alt" style="color:green; padding-right:10px;"></span>Event Date & Time','mage-eventpress'), 'mep_event_date_meta_box_cb', 'mep_events', 'normal', 'high' ); add_meta_box( 'mep-event-date', __('<span class="dashicons dashicons-calendar-alt" style="color:green; padding-right:10px;"></span>Event Date & Time','mage-eventpress'), 'mep_event_date_meta_box_cb', 'mep_events', 'normal', 'high' );
add_meta_box( 'mep-event-emails', __('<span class="dashicons dashicons-email-alt" style="color:green; padding-right:10px;"></span>Event Email text','mage-eventpress'), 'mep_event_email_meta_box_cb', 'mep_events', 'normal', 'high' ); add_meta_box( 'mep-event-emails', __('<span class="dashicons dashicons-email-alt" style="color:green; padding-right:10px;"></span>Event Email text','mage-eventpress'), 'mep_event_email_meta_box_cb', 'mep_events', 'normal', 'high' );
@ -111,16 +111,7 @@ if(array_key_exists('_tax_class', $values)){ $tx_class = $values['_tax_class'][0
<label for="_tax_class"> <?php _e('Tax class','mage-eventpress'); ?> <label for="_tax_class"> <?php _e('Tax class','mage-eventpress'); ?>
<select style="" id="_tax_class" name="_tax_class" class="select short"> <select style="" id="_tax_class" name="_tax_class" class="select short">
<option value="standard" <?php if($tx_class=='standard'){ echo 'Selected'; } ?>>Standard</option> <option value="standard" <?php if($tx_class=='standard'){ echo 'Selected'; } ?>>Standard</option>
<?php <?php echo mep_get_all_tax_list(); ?>
$mep_get_tax_class = get_option( 'woocommerce_tax_classes' );
$mep_get_tax_arr = explode( "\n", get_option( 'woocommerce_tax_classes' ));
foreach ($mep_get_tax_arr as $mep_tax_class ) {
$tax_slug = sanitize_title($mep_tax_class);
?>
<option value="<?php echo $tax_slug; ?>" <?php if($tx_class==$tax_slug){ echo 'Selected'; } ?>><?php echo $mep_tax_class; ?></option>
<?php
}
?>
</select> </select>
</label> </label>
</div> </div>

View File

@ -1,6 +1,6 @@
<?php <?php
function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id, $variation_id ){ function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id, $variation_id ){
if (get_post_type($product_id) == 'mep_events') {
$tp = get_post_meta($product_id,'_price',true); $tp = get_post_meta($product_id,'_price',true);
$new = array(); $new = array();
@ -95,20 +95,39 @@ if(isset($_POST['mep_event_ticket_type'])){
$cnt++; $cnt++;
} }
$mep_events_extra_prices = get_post_meta($product_id, 'mep_events_extra_prices', true);
$us = 0;
foreach($mep_events_extra_prices as $extra_service){
foreach ($new as $key => $val) {
if ($val['option_name'] === $extra_service['option_name']) {
if($val['option_qty'] > 0){
$event_extra[$us]['service_name'] = stripslashes( strip_tags($val['option_name']) );
$event_extra[$us]['service_qty'] = stripslashes(strip_tags($val['option_qty']));
$event_extra[$us]['service_price'] = stripslashes(strip_tags($val['option_price']));
}
}else{
$event_extra = array();
}
}
$us++;
}
$cart_item_data['event_ticket_info'] = $ticket_type_arr; $cart_item_data['event_ticket_info'] = $ticket_type_arr;
$cart_item_data['event_extra_option'] = $new; $cart_item_data['event_extra_option'] = $new;
$cart_item_data['event_user_info'] = $user; $cart_item_data['event_user_info'] = $user;
$cart_item_data['event_tp'] = $tp; $cart_item_data['event_tp'] = $tp;
$cart_item_data['line_total'] = $tp; $cart_item_data['line_total'] = $tp;
$cart_item_data['line_subtotal'] = $tp; $cart_item_data['line_subtotal'] = $tp;
$cart_item_data['event_id'] = $product_id;
$cart_item_data['event_cart_location'] = $event_cart_location; $cart_item_data['event_cart_location'] = $event_cart_location;
$cart_item_data['event_cart_date'] = $event_cart_date; $cart_item_data['event_cart_date'] = $event_cart_date;
}
$cart_item_data['event_id'] = $product_id;
return $cart_item_data; return $cart_item_data;
} }

154
inc/mep_upgrade.php Normal file
View File

@ -0,0 +1,154 @@
<?php
function mep_check_attendee_exists($event_id,$order_id,$name=null,$email=null,$phone=null,$address=null,$gender=null,$company=null,$desg=null,$website=null,$veg=null,$tshirt=null,$type){
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_order_id',
'value' => $order_id,
'compare' => '='
),
array(
'key' => 'ea_ticket_type',
'value' => $type,
'compare' => '='
),
array(
'key' => 'ea_name',
'value' => $name,
'compare' => '='
),
array(
'key' => 'ea_email',
'value' => $email,
'compare' => '='
),
array(
'key' => 'ea_phone',
'value' => $phone,
'compare' => '='
)
)
);
$loop = new WP_Query($args);
return $loop->post_count;
}
add_action('admin_init','mep_get_all_order_data_and_create_attendee');
function mep_get_all_order_data_and_create_attendee(){
if ( get_option( 'mep_event_magor_update_3' ) != 'completed' ) {
global $wpdb;
$args = array(
'limit' => -1,
'return' => 'ids',
);
$query = new WC_Order_Query( $args );
$orders = $query->get_orders();
$c = 1;
foreach($orders as $order_id){
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
}
$event_info = maybe_unserialize(mep_event_get_order_meta($item_id,'_event_user_info'));
$event_id = mep_event_get_order_meta($item_id,'event_id') ? mep_event_get_order_meta($item_id,'event_id') : 0;
if(is_array($event_info) && sizeof($event_info) > 0 && $event_id > 0){
// echo '<pre>';
// print_r(array_merge($event_info,$event_id));
foreach($event_info as $_event_info){
$user_name = isset($_event_info['user_name']) ? $_event_info['user_name'] : '';
$user_email = isset($_event_info['user_email']) ? $_event_info['user_email'] : '';
$user_phone = isset($_event_info['user_phone']) ? $_event_info['user_phone'] : '';
$user_address = isset($_event_info['user_address']) ? $_event_info['user_address'] : '';
$user_gender = isset($_event_info['user_gender']) ? $_event_info['user_gender'] : '';
$user_tshirtsize = isset($_event_info['user_tshirtsize']) ? $_event_info['user_tshirtsize'] : '';
$user_company = isset($_event_info['user_company']) ? $_event_info['user_company'] : '';
$user_designation = isset($_event_info['user_designation']) ? $_event_info['user_designation'] : '';
$user_website = isset($_event_info['user_website']) ? $_event_info['user_website'] : '';
$user_vegetarian = isset($_event_info['user_vegetarian']) ? $_event_info['user_vegetarian'] : '';
$user_ticket_type = isset($_event_info['user_ticket_type']) ? $_event_info['user_ticket_type'] : '';
$check = mep_check_attendee_exists($event_id,$order_id,$user_name,$user_email,$user_phone,$user_address,$user_gender,$user_company,$user_designation,$user_website,$user_vegetarian,$user_tshirtsize,$user_ticket_type);
if($check == 0){
$first_name = isset($order_meta['_billing_first_name'][0]) ? $order_meta['_billing_first_name'][0] : '';
$last_name = isset($order_meta['_billing_last_name'][0]) ? $order_meta['_billing_last_name'][0] : '';
$uname = $first_name.' '.$last_name;
$payment_method = isset($order_meta['_payment_method_title'][0]) ? $order_meta['_payment_method_title'][0] : array();
$user_id = isset($order_meta['_customer_user'][0]) ? $order_meta['_customer_user'][0] : array();
$event_name = get_the_title($event_id);
$order_status = $order->get_status();
$new_post = array(
'post_title' => $uname,
'post_content' => '',
'post_category' => array(), // Usable for custom taxonomies too
'tags_input' => array(),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
$pin = $user_id.$order_id.$event_id.$pid;
update_post_meta( $pid, 'ea_name', $user_name);
update_post_meta( $pid, 'ea_address_1', $user_address);
update_post_meta( $pid, 'ea_email', $user_email);
update_post_meta( $pid, 'ea_phone', $user_phone);
update_post_meta( $pid, 'ea_gender', $user_gender);
update_post_meta( $pid, 'ea_company', $user_company);
update_post_meta( $pid, 'ea_desg', $user_designation);
update_post_meta( $pid, 'ea_website', $user_website);
update_post_meta( $pid, 'ea_vegetarian', $user_vegetarian);
update_post_meta( $pid, 'ea_tshirtsize', $user_tshirtsize);
update_post_meta( $pid, 'ea_ticket_type', $user_ticket_type);
update_post_meta( $pid, 'ea_payment_method', $payment_method);
update_post_meta( $pid, 'ea_event_name', $event_name);
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, 'ea_ticket_no', $pin);
update_post_meta( $pid, 'ea_order_status', $order_status);
}
}
}
}
update_option( 'mep_event_magor_update_3', 'completed' );
}
// die();
}

View File

@ -149,14 +149,14 @@ our support team will back to you shortly.
### How to Add New Event ### How to install Woo Commerce Event Manager Plugin in 3 Minutes
https://www.youtube.com/watch?v=2VLWSUS6GPI https://www.youtube.com/watch?v=_CRPyKHPhTU
### How to Add Ticket Base Event ### WooCommerce Event Manager Pro Addons Setup And Full Functionality Explained
https://www.youtube.com/watch?v=2VLWSUS6GPI https://www.youtube.com/watch?v=LZj6oUavTQg
### How to Buy/Purchase/Booking an Event ### How to Configure Event Manager Attendee Registration Form
https://www.youtube.com/watch?v=IyUCCIeS6P8 https://www.youtube.com/watch?v=F9wnlUjXa6I
**CHECKOUT OUR OTHER PRODUCTS** **CHECKOUT OUR OTHER PRODUCTS**
@ -404,3 +404,16 @@ A. you can create support ticket here with problem details with possible screens
* Update Release: * Update Release:
==> Bug Fixed ==> Bug Fixed
15 Sep 2019* 15 Sep 2019*
*= 2.7.3 =
* Update Release:
==> Bug Fixed
*
*= 2.8.0 =
* Update Release:
==> Bug Fixed
==> Event seating issue fixed while order status chganged
04 Nov 2019*

View File

@ -42,24 +42,23 @@ $simple_rsv = '';
$interval = $datetime1->diff($datetime2); $interval = $datetime1->diff($datetime2);
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true); $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true);
$stc = 0; $total_seat = mep_event_total_seat(get_the_id(),'total');
$leftt = 0; $total_resv = mep_event_total_seat(get_the_id(),'resv');
$total_sold = mep_ticket_sold(get_the_id());
$total_left = $total_seat - ($total_sold + $total_resv);
if (is_array($mep_event_ticket_type) || is_object($mep_event_ticket_type)){ if (is_array($mep_event_ticket_type) || is_object($mep_event_ticket_type)){
foreach ($mep_event_ticket_type as $field ) { foreach ($mep_event_ticket_type as $field ) {
$qm = $field['option_name_t']; $qm = $field['option_name_t'];
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
// $opt_rst_qty = $field['option_rsv_t'] ? $field['option_rsv_t'] : 0;
$tesqn = $post_id.str_replace(' ', '', $qm);
$tesq = get_post_meta($post_id,"mep_xtra_$tesqn",true);
$stc = $stc+$opt_qty;
$llft = ($opt_qty - (int)$tesq);
$leftt = $leftt+$llft;
} }
}else{$qm='';} }else{$qm='';}
if($mep_event_ticket_type){ if($mep_event_ticket_type){
$seat_left = $leftt; $seat_left = $total_left;
}else{ }else{
$seat_left = $seat_left; $seat_left = $total_left;
} }
@ -122,29 +121,7 @@ if(array_key_exists('mep_rsv_seat', $event_meta)){
$mep_available_seat = 'on'; $mep_available_seat = 'on';
} }
if($mep_event_ticket_type){ $leftt = $total_left;
$stc = 0;
$leftt = 0;
$res = 0;
foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$tesqn = $post->ID.str_replace(' ', '', $qm);
$tesq = get_post_meta($post->ID,"mep_xtra_$tesqn",true);
$stc = $stc+$opt_qty;
$res = $res + (int)$opt_rst_qty;
$res = (int)$res;
$llft = ($opt_qty - (int)$tesq);
$leftt = ($leftt+$llft);
}
$leftt = $leftt-$res;
}else{
$leftt = $event_meta['mep_total_seat'][0]- $total_book;
}
$days = $interval->d; $days = $interval->d;
$hours = $interval->h; $hours = $interval->h;
$minutes = $interval->i; $minutes = $interval->i;
@ -168,6 +145,7 @@ if($reg_status!='off'){
<form action="" method='post'> <form action="" method='post'>
<?php <?php
do_action('mep_event_ticket_type_extra_service'); do_action('mep_event_ticket_type_extra_service');
if($leftt>0){ if($leftt>0){
?> ?>
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/> <input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
@ -176,12 +154,12 @@ if($reg_status!='off'){
<td align="left" class='total-col'><?php echo mep_get_option('mep_quantity_text', 'label_setting_sec') ? mep_get_option('mep_quantity_text', 'label_setting_sec') : _e('Quantity:','mage-eventpress'); <td align="left" class='total-col'><?php echo mep_get_option('mep_quantity_text', 'label_setting_sec') ? mep_get_option('mep_quantity_text', 'label_setting_sec') : _e('Quantity:','mage-eventpress');
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true); $mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){ ?> if($mep_event_ticket_type){ ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden"> <input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
<span id="ttyttl"></span> <span id="ttyttl"></span>
<?php <?php
}else{ }else{
if($event_sqi==1){ if($event_sqi==1){
$qmx = ($event_meta['mep_total_seat'][0]- $total_book); $qmx = $leftt;
if($qty_typec=='dropdown'){ ?> if($qty_typec=='dropdown'){ ?>
<select name="quantity" id="quantity_5a7abbd1bff73" class='input-text qty text extra-qty-box'> <select name="quantity" id="quantity_5a7abbd1bff73" class='input-text qty text extra-qty-box'>
<?php for ($i = 1; $i <= $qmx; $i++) { ?> <?php for ($i = 1; $i <= $qmx; $i++) { ?>
@ -189,13 +167,13 @@ if($event_sqi==1){
<?php } ?> <?php } ?>
</select> </select>
<?php }else{ ?> <?php }else{ ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="number"> <input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="number">
<?php <?php
} }
}else{ }else{
echo 1; echo 1;
?> ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden"> <input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
<?php <?php
} }
} }

View File

@ -22,19 +22,15 @@ if($mep_event_ticket_type){
<?php <?php
$count =1; $count =1;
foreach ( $mep_event_ticket_type as $field ) { foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$rsv = (int)$opt_rst_qty;
$tesqn = $pid.str_replace(' ', '', $qm);
$tesq = get_post_meta($pid,"mep_xtra_$tesqn",true);
$tesq = ((int)$tesq + (int)$rsv);
$llft = ($opt_qty - (int)$tesq);
$qty_t_type = $field['option_qty_t_type']; $qty_t_type = $field['option_qty_t_type'];
$total_quantity = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$total_resv_quantity = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$total_sold = (int) mep_ticket_type_sold(get_the_id(),$field['option_name_t']);
$total_left = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity);
?> ?>
<tr> <tr>
<td align="Left"><?php echo $field['option_name_t']; ?> <td align="Left"><?php echo $field['option_name_t']; ?>
<?php if($mep_available_seat=='on'){ ?><div class="xtra-item-left"><?php echo max($llft,0); ?> <?php _e('Left','mage-eventpress'); ?></div> <?php } ?> <?php if($mep_available_seat=='on'){ ?><div class="xtra-item-left"><?php echo max($total_left,0); ?> <?php _e('Left','mage-eventpress'); ?></div> <?php } ?>
</td> </td>
<td class="ticket-qty"> <td class="ticket-qty">
<span class="tkt-qty"> <span class="tkt-qty">
@ -42,23 +38,22 @@ $qty_t_type = $field['option_qty_t_type'];
</span> </span>
<?php <?php
if($llft>0){ if($total_left>0){
//echo $llft;
if($qty_t_type=='dropdown'){ ?> if($qty_t_type=='dropdown'){ ?>
<select name="option_qty[]" id="eventpxtp_<?php echo $count; ?>" <?php if($llft<=0){ ?> style='display: none!important;' <?php } ?> class='extra-qty-box etp'> <select name="option_qty[]" id="eventpxtp_<?php echo $count; ?>" <?php if($total_left<=0){ ?> style='display: none!important;' <?php } ?> class='extra-qty-box etp'>
<?php for ($i = 0; $i <= $llft; $i++) { ?> <?php for ($i = 0; $i <= $total_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option> <option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option>
<?php } ?> <?php } ?>
</select> </select>
<?php }else{ ?> <?php }else{ ?>
<input id="eventpxtp_<?php echo $count; ?>" <?php //if($ext_left<=0){ echo "disabled"; } ?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box etp' name='option_qty[]' data-price='<?php echo $field['option_price_t']; ?>' value='0' min="0" max="<?php echo max($llft,0); ?>"> <input id="eventpxtp_<?php echo $count; ?>" <?php //if($ext_left<=0){ echo "disabled"; } ?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box etp' name='option_qty[]' data-price='<?php echo $field['option_price_t']; ?>' value='0' min="0" max="<?php echo max($total_left,0); ?>">
<?php } }else{ _e('No Seat Available','mage-eventpress'); } ?> <?php } }else{ _e('No Seat Available','mage-eventpress'); } ?>
</td> </td>
<td class="ticket-price"><span class="tkt-pric"> <td class="ticket-price"><span class="tkt-pric">
<?php echo mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') ? mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') : _e('Per Ticket Price:','mage-eventpress'); ?> <?php echo mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') ? mep_get_option('mep_per_ticket_price_text', 'label_setting_sec') : _e('Per Ticket Price:','mage-eventpress'); ?>
</span> <strong><?php echo wc_price($field['option_price_t']); ?></strong> </span> <strong><?php echo wc_price($field['option_price_t']); ?></strong>
<?php if($llft>0){ ?> <?php if($total_left>0){ ?>
<p style="display: none;" class="price_jq"><?php echo $field['option_price_t']; ?></p> <p style="display: none;" class="price_jq"><?php echo $field['option_price_t']; ?></p>
<input type="hidden" name='option_name[]' value='<?php echo $field['option_name_t']; ?>'> <input type="hidden" name='option_name[]' value='<?php echo $field['option_name_t']; ?>'>
<input type="hidden" name='option_price[]' value='<?php echo $field['option_price_t']; ?>'> <input type="hidden" name='option_price[]' value='<?php echo $field['option_price_t']; ?>'>

View File

@ -1,56 +1,21 @@
<?php <?php
add_action('mep_event_seat','mep_ev_seat'); add_action('mep_event_seat','mep_ev_seat');
function mep_ev_seat(){ function mep_ev_seat(){
global $post,$event_meta,$total_book; global $post,$event_meta;
if(array_key_exists('mep_rsv_seat', $event_meta)){
$simple_rsv = $event_meta['mep_rsv_seat'][0];
}else{
$simple_rsv = '';
}
if($simple_rsv){
$simple_rsv = $simple_rsv;
}else{
$simple_rsv = 0;
}
$total_book = ($total_book + $simple_rsv);
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true); $mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if(array_key_exists('mep_available_seat', $event_meta)){ if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0]; $mep_available_seat = $event_meta['mep_available_seat'][0];
}else{ }else{
$mep_available_seat = 'on'; $mep_available_seat = 'on';
} }
if($mep_event_ticket_type){ if($mep_event_ticket_type){
$stc = 0; $total_seat = mep_event_total_seat(get_the_id(),'total');
$leftt = 0; $total_resv = mep_event_total_seat(get_the_id(),'resv');
$res = 0; $total_sold = mep_ticket_sold(get_the_id());
foreach ( $mep_event_ticket_type as $field ) { $total_left = $total_seat - ($total_sold + $total_resv);
$qm = $field['option_name_t'];
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$tesqn = $post->ID.str_replace(' ', '', $qm);
$tesq = get_post_meta($post->ID,"mep_xtra_$tesqn",true);
$stc = $stc+$opt_qty;
$res = $res + (int)$opt_rst_qty;
$res = (int)$res;
$llft = ($opt_qty - (int)$tesq);
$leftt = ($leftt+$llft);
}
$leftt = $leftt-$res;
?> ?>
<h5><strong><?php echo mep_get_option('mep_total_seat_text', 'label_setting_sec') ? mep_get_option('mep_total_seat_text', 'label_setting_sec') : _e('Total Seat:','mage-eventpress'); ?></strong> <?php echo $stc; if($mep_available_seat=='on'){ ?> (<strong><?php echo max($leftt,0); ?></strong> <?php _e('Left','mage-eventpress'); ?>)<?php } ?></h5> <h5><strong><?php echo mep_get_option('mep_total_seat_text', 'label_setting_sec') ? mep_get_option('mep_total_seat_text', 'label_setting_sec') : _e('Total Seat:','mage-eventpress'); ?></strong> <?php echo $total_seat; if($mep_available_seat=='on'){ ?> (<strong><?php echo max($total_left,0); ?></strong> <?php _e('Left','mage-eventpress'); ?>)<?php } ?></h5>
<?php <?php
}else{
if($event_meta['mep_total_seat'][0]){ ?>
<h5><strong><?php echo mep_get_option('mep_total_seat_text', 'label_setting_sec') ? mep_get_option('mep_total_seat_text', 'label_setting_sec') : _e('Total Seat:','mage-eventpress'); ?></strong> <?php echo $event_meta['mep_total_seat'][0]; if($mep_available_seat=='on'){ ?> (<strong><?php echo max(($event_meta['mep_total_seat'][0]- $total_book),0); ?></strong> <?php _e('Left','mage-eventpress'); ?>) <?php } ?></h5>
<?php }
} }
} }

View File

@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Events Manager * Plugin Name: Woocommerce Events Manager
* Plugin URI: http://mage-people.com * Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople.. * Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 2.7.3 * Version: 2.8.0
* Author: MagePeople Team * Author: MagePeople Team
* Author URI: http://www.mage-people.com/ * Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress * Text Domain: mage-eventpress
@ -26,6 +26,7 @@ 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_user_custom_style.php");
require_once(dirname(__FILE__) . "/inc/mep_tax_meta.php"); require_once(dirname(__FILE__) . "/inc/mep_tax_meta.php");
require_once(dirname(__FILE__) . "/inc/mep_addon_list.php"); require_once(dirname(__FILE__) . "/inc/mep_addon_list.php");
require_once(dirname(__FILE__) . "/inc/mep_upgrade.php");
// Language Load // Language Load
add_action( 'init', 'mep_language_load'); add_action( 'init', 'mep_language_load');
@ -44,22 +45,51 @@ function mep_flash_permalink_once() {
} }
add_action( 'admin_init', 'mep_flash_permalink_once' ); add_action( 'admin_init', 'mep_flash_permalink_once' );
// add_action( 'admin_init', 'mep_check_builder_status' );
function mep_check_builder_status(){
$version = '3.2';
if(is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' )){
$data = get_plugin_data( ABSPATH . "wp-content/plugins/woocommerce-event-manager-addon-form-builder/addon-builder.php", false, false );
if ( is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' ) && $data['Version'] >= $version ) {
return true;
}elseif ( is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' ) && $data['Version'] < $version ) {
return false;
}else{
return true;
}
}else{
return true;
}
}
function mep_get_all_tax_list($current_tax=null){
global $wpdb;
$table_name = $wpdb->prefix . 'wc_tax_rate_classes';
$result = $wpdb->get_results( "SELECT * FROM $table_name" );
foreach ( $result as $tax ){
?>
<option value="<?php echo $tax->slug; ?>" <?php if($current_tax == $tax->slug ){ echo 'Selected'; } ?>><?php echo $tax->name; ?></option>
<?php
}
}
// Class for Linking with Woocommerce with Event Pricing // Class for Linking with Woocommerce with Event Pricing
add_action('plugins_loaded', 'mep_load_wc_class'); add_action('plugins_loaded', 'mep_load_wc_class');
function mep_load_wc_class() { function mep_load_wc_class() {
if ( class_exists('WC_Product_Data_Store_CPT') ) { if ( class_exists('WC_Product_Data_Store_CPT') ) {
class MEP_Product_Data_Store_CPT extends WC_Product_Data_Store_CPT { class MEP_Product_Data_Store_CPT extends WC_Product_Data_Store_CPT {
public function read( &$product ) { public function read( &$product ) {
$product->set_defaults(); $product->set_defaults();
if ( ! $product->get_id() || ! ( $post_object = get_post( $product->get_id() ) ) || ! in_array( $post_object->post_type, array( 'mep_events', 'product' ) ) ) { // change birds with your post type if ( ! $product->get_id() || ! ( $post_object = get_post( $product->get_id() ) ) || ! in_array( $post_object->post_type, array( 'mep_events', 'product' ) ) ) { // change birds with your post type
throw new Exception( __( 'Invalid product.', 'woocommerce' ) ); throw new Exception( __( 'Invalid product.', 'woocommerce' ) );
} }
@ -129,8 +159,6 @@ function mep_woocommerce_data_stores ( $stores ) {
return $stores; return $stores;
} }
} else { } else {
add_action('admin_notices', 'wc_not_loaded'); add_action('admin_notices', 'wc_not_loaded');
@ -206,37 +234,172 @@ global $wpdb;
foreach( $results as $result ) { foreach( $results as $result ) {
$value = $result->meta_value; $value = $result->meta_value;
} }
return $value; $val = isset($value) ? $value : '';
return $val;
} }
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10);
function mep_event_booking_management( $order_id) {
if(mep_check_builder_status()){
add_action( 'woocommerce_thankyou','mep_set_first_order_sts'); if ( ! $order_id )
function mep_set_first_order_sts($order_id ){ return;
// Getting an instance of the order object // Getting an instance of the order object
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id); $order_meta = get_post_meta($order_id);
$order_status = $order->get_status();
# Iterating through each order items (WC_Order_Item_Product objects in WC 3+) # Iterating through each order items (WC_Order_Item_Product objects in WC 3+)
foreach ( $order->get_items() as $item_id => $item_values ) { foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id; $item_id = $item_id;
}
$product_id = mep_event_get_order_meta($item_id,'_product_id'); $event_id = wc_get_order_item_meta($item_id,'event_id',true);
if($product_id==0){
$event_id = mep_event_get_order_meta($item_id,'event_id');
if (get_post_type($event_id) == 'mep_events') { if (get_post_type($event_id) == 'mep_events') {
$mep_atnd = "_mep_atnd_".$order_id; $event_name = get_the_title($event_id);
update_post_meta( $event_id, $mep_atnd, "a1"); $user_info_arr = wc_get_order_item_meta($item_id,'_event_user_info',true);
} $service_info_arr = wc_get_order_item_meta($item_id,'_event_service_info',true);
$event_ticket_info_arr = wc_get_order_item_meta($item_id,'_event_ticket_info',true);
$item_quantity = 0;
foreach ( $event_ticket_info_arr as $field ) {
if($field['ticket_qty']>0){
$item_quantity = $item_quantity + $field['ticket_qty'];
} }
} }
$first_name = isset($order_meta['_billing_first_name'][0]) ? $order_meta['_billing_first_name'][0] : '';
$last_name = isset($order_meta['_billing_last_name'][0]) ? $order_meta['_billing_last_name'][0] : '';
$company_name = isset($order_meta['_billing_company'][0]) ? $order_meta['_billing_company'][0] : '';
$address_1 = isset($order_meta['_billing_address_1'][0]) ? $order_meta['_billing_address_1'][0] : '';
$address_2 = isset($order_meta['_billing_address_2'][0]) ? $order_meta['_billing_address_2'][0] : '';
$city = isset($order_meta['_billing_city'][0]) ? $order_meta['_billing_city'][0] : '';
$state = isset($order_meta['_billing_state'][0]) ? $order_meta['_billing_state'][0] : '';
$postcode = isset($order_meta['_billing_postcode'][0]) ? $order_meta['_billing_postcode'][0] : '';
$country = isset($order_meta['_billing_country'][0]) ? $order_meta['_billing_country'][0] : '';
$email = isset($order_meta['_billing_email'][0]) ? $order_meta['_billing_email'][0] : '';
$phone = isset($order_meta['_billing_phone'][0]) ? $order_meta['_billing_phone'][0] : '';
$billing_intotal = isset($order_meta['_billing_address_index'][0]) ? $order_meta['_billing_address_index'][0] : '';
$payment_method = isset($order_meta['_payment_method_title'][0]) ? $order_meta['_payment_method_title'][0] : '';
$user_id = isset($order_meta['_customer_user'][0]) ? $order_meta['_customer_user'][0] : '';
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
$uname = $_user_info['user_name'];
$email = $_user_info['user_email'];
$phone = $_user_info['user_phone'];
$address = $_user_info['user_address'];
$gender = $_user_info['user_gender'];
$company = $_user_info['user_company'];
$designation = $_user_info['user_designation'];
$website = $_user_info['user_website'];
$vegetarian = $_user_info['user_vegetarian'];
$tshirtsize = $_user_info['user_tshirtsize'];
$ticket_type = $_user_info['user_ticket_type'];
$mep_ucf = isset($_user_info['mep_ucf']) ? $_user_info['mep_ucf'] : "";
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
'post_title' => $uname,
'post_content' => '',
'post_category' => array(), // Usable for custom taxonomies too
'tags_input' => array(),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
$pin = $user_id.$order_id.$event_id.$pid;
update_post_meta( $pid, 'ea_name', $uname);
update_post_meta( $pid, 'ea_address_1', $address);
update_post_meta( $pid, 'ea_email', $email);
update_post_meta( $pid, 'ea_phone', $phone);
update_post_meta( $pid, 'ea_gender', $gender);
update_post_meta( $pid, 'ea_company', $company);
update_post_meta( $pid, 'ea_desg', $designation);
update_post_meta( $pid, 'ea_website', $website);
update_post_meta( $pid, 'ea_vegetarian', $vegetarian);
update_post_meta( $pid, 'ea_tshirtsize', $tshirtsize);
update_post_meta( $pid, 'ea_ticket_type', $ticket_type);
update_post_meta( $pid, 'ea_payment_method', $payment_method);
update_post_meta( $pid, 'ea_event_name', $event_name);
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, 'ea_ticket_no', $pin);
update_post_meta( $pid, 'ea_order_status', $order_status);
// Checking if the form builder addon is active and have any custom fields
$mep_form_builder_data = get_post_meta($event_id, 'mep_form_builder_data', true);
if ( $mep_form_builder_data ) {
foreach ( $mep_form_builder_data as $_field ) {
update_post_meta( $pid, "ea_".$_field['mep_fbc_id'], $_user_info[$_field['mep_fbc_id']]);
}
} // End User Form builder data update loop
} // End User Array Foreach Loop
}else{
//for ($x = 1; $x <= count($event_ticket_info_arr); $x++) {
foreach($event_ticket_info_arr as $tinfo){
$uname = $first_name.' '.$last_name;
// ADD THE FORM INPUT TO $new_post ARRAY
for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) {
$new_post = array(
'post_title' => $uname,
'post_content' => '',
'post_category' => array(), // Usable for custom taxonomies too
'tags_input' => array(),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
$count = ($x -1);
$pin = $user_id.$order_id.$event_id.$pid;
$ticket_type = $tinfo['ticket_name'];
// $ticket_type = $event_ticket_info_arr[$count]['ticket_name'];
update_post_meta( $pid, 'ea_name', $uname);
update_post_meta( $pid, 'ea_address_1', $address_1);
update_post_meta( $pid, 'ea_email', $email);
update_post_meta( $pid, 'ea_phone', $phone);
update_post_meta( $pid, 'ea_gender', '');
update_post_meta( $pid, 'ea_company', $company_name);
update_post_meta( $pid, 'ea_desg', '');
update_post_meta( $pid, 'ea_website', '');
update_post_meta( $pid, 'ea_vegetarian', '');
update_post_meta( $pid, 'ea_tshirtsize', '');
update_post_meta( $pid, 'ea_ticket_type', $ticket_type);
update_post_meta( $pid, 'ea_payment_method', $payment_method);
update_post_meta( $pid, 'ea_event_name', $event_name);
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, 'ea_ticket_no', $pin);
update_post_meta( $pid, 'ea_order_status', $order_status);
}
}
}
} // end of check post type
}
do_action('mep_after_event_booking',$order_id,$order->get_status());
}
}
add_action('woocommerce_checkout_order_processed', 'mep_event_order_status_make_pending', 10, 1); add_action('woocommerce_checkout_order_processed', 'mep_event_order_status_make_pending', 10, 1);
@ -257,6 +420,8 @@ $product_id = mep_event_get_order_meta($item_id,'_product_id');
if($product_id==0){ if($product_id==0){
$event_id = mep_event_get_order_meta($item_id,'event_id'); $event_id = mep_event_get_order_meta($item_id,'event_id');
if (get_post_type($event_id) == 'mep_events') { if (get_post_type($event_id) == 'mep_events') {
$mep_atnd = "_mep_atnd_".$order_id;
update_post_meta( $event_id, $mep_atnd, "a1");
$order_meta_text = "_stock_msg_".$order_id; $order_meta_text = "_stock_msg_".$order_id;
$order_processing = "pending_".$order_id; $order_processing = "pending_".$order_id;
update_post_meta( $event_id, $order_meta_text, $order_processing); update_post_meta( $event_id, $order_meta_text, $order_processing);
@ -265,8 +430,110 @@ if($product_id==0){
} }
function change_attandee_order_status($order_id,$set_status,$post_status,$qr_status=null){
$args = array (
'post_type' => array( 'mep_events_attendees' ),
'posts_per_page' => -1,
'post_status' => $post_status,
'meta_query' => array(
array(
'key' => 'ea_order_id',
'value' => $order_id,
'compare' => '='
)
)
);
$loop = new WP_Query($args);
$tid = array();
foreach ($loop->posts as $ticket) {
$post_id = $ticket->ID;
if(!empty($qr_status)){
update_post_meta($post_id, 'ea_order_status', $qr_status);
}
$current_post = get_post( $post_id, 'ARRAY_A' );
$current_post['post_status'] = $set_status;
wp_update_post($current_post);
}
}
add_action('wp_trash_post','mep_addendee_trash',90);
function mep_addendee_trash( $post_id ) {
$post_type = get_post_type( $post_id );
$post_status = get_post_status( $post_id );
if ( $post_type == 'shop_order' ) {
change_attandee_order_status( $post_id, 'trash', 'publish', '' );
}
}
add_action('untrash_post','mep_addendee_untrash',90);
function mep_addendee_untrash( $post_id ) {
$post_type = get_post_type( $post_id );
$post_status = get_post_status( $post_id );
if ( $post_type == 'shop_order' ) {
$order = wc_get_order( $post_id );
$order_status = $order->get_status();
change_attandee_order_status( $post_id, 'publish', 'trash', '' );
}
}
add_action('woocommerce_order_status_changed', 'mep_attendee_status_update', 10, 4);
function mep_attendee_status_update($order_id, $from_status, $to_status, $order ){
if(mep_check_builder_status()){
global $wpdb,$wotm;
// Getting an instance of the order object
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
$email = isset($order_meta['_billing_email'][0]) ? $order_meta['_billing_email'][0] : array();
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
$event_id = mep_event_get_order_meta($item_id,'event_id');
if (get_post_type($event_id) == 'mep_events') {
if($order->has_status( 'processing' ) ) {
change_attandee_order_status($order_id,'publish','trash','processing');
change_attandee_order_status($order_id,'publish','publish','processing');
}
if($order->has_status( 'pending' )) {
change_attandee_order_status($order_id,'publish','trash','pending');
change_attandee_order_status($order_id,'publish','publish','pending');
}
if($order->has_status( 'on-hold' )) {
change_attandee_order_status($order_id,'publish','trash','on-hold');
change_attandee_order_status($order_id,'publish','publish','on-hold');
}
if($order->has_status( 'completed' ) ) {
mep_event_confirmation_email_sent($event_id,$email);
change_attandee_order_status($order_id,'publish','trash','completed');
change_attandee_order_status($order_id,'publish','publish','completed');
}
if($order->has_status( 'cancelled' ) ) {
change_attandee_order_status($order_id,'trash','publish','cancelled');
}
if($order->has_status( 'refunded' ) ) {
change_attandee_order_status($order_id,'trash','publish','refunded');
}
if($order->has_status( 'failed' ) ) {
change_attandee_order_status($order_id,'trash','publish','failed');
}
} // End of Post Type Check
} // End order item foreach
} // End builder version check
} // End Function
// add_action('woocommerce_order_status_changed', 'your_function', 10, 4);
add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4); add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4);
function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) { function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) {
global $wpdb; global $wpdb;
@ -379,17 +646,12 @@ if($order->has_status( 'cancelled' ) || $order->has_status( 'refunded' ) || $ord
} }
if( $order->has_status( 'completed' )) { if( $order->has_status( 'completed' )) {
update_post_meta( $event_id, $mep_atnd, "a2"); update_post_meta( $event_id, $mep_atnd, "a2");
// update_post_meta( $event_id, $order_meta_text, $order_completed); // update_post_meta( $event_id, $order_meta_text, $order_completed);
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0); $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); $mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
mep_event_confirmation_email_sent($event_id,$email); // mep_event_confirmation_email_sent($event_id,$email);
if($ordr_total==0){ if($ordr_total==0){
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity)); update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
} }
@ -493,14 +755,6 @@ function mep_attendee_filter_query($query) {
} }
// Add the data to the custom columns for the book post type: // Add the data to the custom columns for the book post type:
add_action( 'manage_mep_events_posts_custom_column' , 'mep_custom_event_column', 10, 2 ); add_action( 'manage_mep_events_posts_custom_column' , 'mep_custom_event_column', 10, 2 );
function mep_custom_event_column( $column, $post_id ) { function mep_custom_event_column( $column, $post_id ) {
@ -562,6 +816,7 @@ function mep_event_redirect_to_checkout() {
} }
} }
add_action('init','mep_include_template_parts'); add_action('init','mep_include_template_parts');
function mep_include_template_parts(){ function mep_include_template_parts(){
$template_name = 'templating.php'; $template_name = 'templating.php';
@ -666,12 +921,7 @@ function mep_add_to_google_calender_link($pid){
$event_end = $event_meta['mep_event_end_date'][0]; $event_end = $event_meta['mep_event_end_date'][0];
$location = $event_meta['mep_location_venue'][0]." ".$event_meta['mep_street'][0]." ".$event_meta['mep_city'][0]." ".$event_meta['mep_state'][0]." ".$event_meta['mep_postcode'][0]." ".$event_meta['mep_country'][0]; $location = $event_meta['mep_location_venue'][0]." ".$event_meta['mep_street'][0]." ".$event_meta['mep_city'][0]." ".$event_meta['mep_state'][0]." ".$event_meta['mep_postcode'][0]." ".$event_meta['mep_country'][0];
ob_start(); ob_start();
?> ?>
<div id="mep_add_calender_button" class='mep-add-calender'><i class="fa fa-calendar"></i><?php _e(mep_get_label($pid,'mep_calender_btn_text','Add Calendar'),'mage-eventpress'); ?></div> <div id="mep_add_calender_button" class='mep-add-calender'><i class="fa fa-calendar"></i><?php _e(mep_get_label($pid,'mep_calender_btn_text','Add Calendar'),'mage-eventpress'); ?></div>
@ -1046,37 +1296,11 @@ $org_id = $org_arr[0]->term_id;
function mep_get_total_available_seat($event_id, $event_meta){ function mep_get_total_available_seat($event_id, $event_meta){
$book_count = get_post_meta(get_the_id(),'total_booking', true); $total_seat = mep_event_total_seat($event_id,'total');
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; } $total_resv = mep_event_total_seat($event_id,'resv');
$simple_rsv = $event_meta['mep_rsv_seat'][0]; $total_sold = mep_ticket_sold($event_id);
if($simple_rsv){ $total_left = $total_seat - ($total_sold + $total_resv);
$simple_rsv = $simple_rsv; return $total_left;
}else{
$simple_rsv = 0;
}
$total_book = ($total_book + $simple_rsv);
$mep_event_ticket_type = get_post_meta(get_the_id(), 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$stc = 0;
$leftt = 0;
$res = 0;
foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
$tesqn = get_the_id().str_replace(' ', '', $qm);
$tesq = get_post_meta(get_the_id(),"mep_xtra_$tesqn",true);
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$stc = $stc+$opt_qty;
$res = $res + (int)$opt_rst_qty;
$res = (int)$res;
$llft = ($opt_qty - (int)$tesq);
$leftt = ($leftt+$llft);
}
$leftt = $leftt-$res;
}else{
$leftt = (int) $event_meta['mep_total_seat'][0]- (int) $total_book;
}
return $leftt;
} }
@ -1155,7 +1379,6 @@ if($item_name=='mep_location_venue'){
return null; return null;
} }
if($item_name=='mep_location_venue'){ if($item_name=='mep_location_venue'){
if($location_sts){ if($location_sts){
$org_arr = get_the_terms( $event_id, 'mep_org' ); $org_arr = get_the_terms( $event_id, 'mep_org' );
@ -1398,48 +1621,13 @@ function mep_wc_price( $price, $args = array() ) {
function mep_get_event_total_seat($event_id){ function mep_get_event_total_seat($event_id){
$event_meta = get_post_custom($event_id); $total_seat = mep_event_total_seat($event_id,'total');
$book_count = get_post_meta($event_id,'total_booking', true); $total_resv = mep_event_total_seat($event_id,'resv');
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; } $total_sold = mep_ticket_sold($event_id);
if(array_key_exists('mep_rsv_seat', $event_meta)){ $total_left = $total_seat - ($total_sold + $total_resv);
$simple_rsv = $event_meta['mep_rsv_seat'][0];
}else{
$simple_rsv = '';
}
if($simple_rsv){
$simple_rsv = $simple_rsv;
}else{
$simple_rsv = 0;
}
$total_book = ($total_book + $simple_rsv);
$mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$stc = 0;
$leftt = 0;
$res = 0;
foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
$tesqn = $event_id.str_replace(' ', '', $qm);
$tesq = get_post_meta($event_id,"mep_xtra_$tesqn",true);
$opt_qty = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
$opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
$stc = $stc+$opt_qty;
$res = $res + (int)$opt_rst_qty;
$res = (int)$res;
$llft = ($opt_qty - (int)$tesq);
$leftt = ($leftt+$llft);
}
$leftt = $leftt-$res;
?> ?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo $leftt; ?>/<?php echo $stc; ?> </span> <span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo $total_left; ?>/<?php echo $total_seat; ?> </span>
<?php <?php
}else{
if(isset($event_meta['mep_total_seat'][0])){ ?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>/<?php echo $event_meta['mep_total_seat'][0]; ?></span>
<?php }
}
} }
@ -1473,7 +1661,7 @@ function mep_reset_event_booking($event_id){
$loop = new WP_Query($args_search_qqq); $loop = new WP_Query($args_search_qqq);
while ($loop->have_posts()) { while ($loop->have_posts()) {
$loop->the_post(); $loop->the_post();
$post_id = get_the_id(); // change this to your post ID $post_id = get_the_id();
$status = 'trash'; $status = 'trash';
$current_post = get_post( $post_id, 'ARRAY_A' ); $current_post = get_post( $post_id, 'ARRAY_A' );
$current_post['post_status'] = $status; $current_post['post_status'] = $status;
@ -1520,6 +1708,96 @@ function mep_get_term_as_class($post_id,$taxonomy){
} }
function mep_ticket_type_sold($event_id,$type){
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_ticket_type',
'value' => $type,
'compare' => '='
)
),array(
'relation' => 'OR',
array(
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
),
array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
)
)
)
);
$loop = new WP_Query($args);
return $loop->post_count;
}
function mep_ticket_sold($event_id){
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => 'ea_event_id',
'value' => $event_id,
'compare' => '='
)
),array(
'relation' => 'OR',
array(
'key' => 'ea_order_status',
'value' => 'processing',
'compare' => '='
),
array(
'key' => 'ea_order_status',
'value' => 'completed',
'compare' => '='
)
)
)
);
$loop = new WP_Query($args);
return $loop->post_count;
}
function mep_event_total_seat($event_id,$type){
$mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true);
// print_r($mep_event_ticket_type);
$total = 0;
foreach ( $mep_event_ticket_type as $field ) {
if($type == 'total'){
$total_name = (int) $field['option_qty_t'];
}elseif($type == 'resv'){
$total_name = (int) $field['option_rsv_t'];
}
$total = $total_name + $total;
}
return $total;
}
}else{ }else{
function mep_admin_notice_wc_not_active() { function mep_admin_notice_wc_not_active() {