This commit is contained in:
magepeopleteam 2020-01-29 11:45:33 +00:00
parent 9cc4a2add8
commit 88e634bf66
11 changed files with 501 additions and 211 deletions

View File

@ -915,12 +915,13 @@ function mep_event_ticket_type() {
<table id="repeatable-fieldset-one-t" width="100%"> <table id="repeatable-fieldset-one-t" width="100%">
<thead> <thead>
<tr> <tr>
<th width="30%"><?php _e('Ticket Type Name','mage-eventpress'); ?></th> <th width="30%"><?php _e( 'Ticket Type Name', 'mage-eventpress' ); ?></th>
<th width="30%"><?php _e('Ticket Price','mage-eventpress'); ?></th> <th width="15%"><?php _e( 'Ticket Price', 'mage-eventpress' ); ?></th>
<th width="20%"><?php _e('Available Qty','mage-eventpress'); ?></th> <th width="15%"><?php _e( 'Available Qty', 'mage-eventpress' ); ?></th>
<th width="20%"><?php _e('Reserve Qty','mage-eventpress'); ?></th> <?php echo $rsvqty = '<th width="15%">'. esc_html__( "Reserve Qty", "mage-eventpress" ) .'</th>';
<th width="10%"><?php _e('Qty Box Type','mage-eventpress'); ?></th> apply_filters( 'mep_add_extra_column', $rsvqty); ?>
<th width="10%"></th> <th width="10%"><?php _e( 'Qty Box Type', 'mage-eventpress' ); ?></th>
<th width="10%"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -941,6 +942,7 @@ $opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
<td><input type="number" class="widefat" name="option_qty_t[]" placeholder="Ex: 500" value="<?php if(isset($field['option_qty_t'])){ echo $field['option_qty_t']; }else{ echo 0; } ?>" /></td> <td><input type="number" class="widefat" name="option_qty_t[]" placeholder="Ex: 500" value="<?php if(isset($field['option_qty_t'])){ echo $field['option_qty_t']; }else{ echo 0; } ?>" /></td>
<td><input type="number" class="widefat" name="option_rsv_t[]" placeholder="Ex: 5" value="<?php if(isset($field['option_rsv_t'])){ echo $field['option_rsv_t']; }else{ echo 0; } ?>" /></td> <td><input type="number" class="widefat" name="option_rsv_t[]" placeholder="Ex: 5" value="<?php if(isset($field['option_rsv_t'])){ echo $field['option_rsv_t']; }else{ echo 0; } ?>" /></td>
<?php do_action( 'mep_add_extra_input_box', $field) ?>
<td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''> <td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''>
<option value="inputbox" <?php if($qty_t_type=='inputbox'){ echo "Selected"; } ?>><?php _e('Input Box','mage-eventpress'); ?></option> <option value="inputbox" <?php if($qty_t_type=='inputbox'){ echo "Selected"; } ?>><?php _e('Input Box','mage-eventpress'); ?></option>
@ -964,7 +966,8 @@ $opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
<td><input type="text" class="widefat" name="option_name_t[]" placeholder="Ex: Adult" /></td> <td><input type="text" class="widefat" name="option_name_t[]" placeholder="Ex: Adult" /></td>
<td><input type="number" class="widefat" step="0.01" name="option_price_t[]" placeholder="Ex: 10" value="" /></td> <td><input type="number" class="widefat" step="0.01" name="option_price_t[]" placeholder="Ex: 10" value="" /></td>
<td><input type="number" class="widefat" name="option_qty_t[]" placeholder="Ex: 15" value="" /></td> <td><input type="number" class="widefat" name="option_qty_t[]" placeholder="Ex: 15" value="" /></td>
<td><input type="number" class="widefat" name="option_rsv_t[]" placeholder="Ex: 5" value="" /></td> <?php echo $option_rsv_t = '<td><input type="number" class="widefat" name="option_rsv_t[]" placeholder="Ex: 5" value=""/></td>'?>
<?php apply_filters('mep_add_field_to_ticket_type', $option_rsv_t); ?>
<td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''><option value=""><?php _e('Please Select Type','mage-eventpress'); ?></option><option value="inputbox"><?php _e('Input Box','mage-eventpress'); ?></option><option value="dropdown"><?php _e('Dropdown List','mage-eventpress'); ?></option></select></td> <td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''><option value=""><?php _e('Please Select Type','mage-eventpress'); ?></option><option value="inputbox"><?php _e('Input Box','mage-eventpress'); ?></option><option value="dropdown"><?php _e('Dropdown List','mage-eventpress'); ?></option></select></td>
<td> <td>

View File

@ -30,7 +30,11 @@ function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id,
if(isset($_POST['option_qty'])){ if(isset($_POST['option_qty'])){
$qty = $_POST['option_qty']; $qty = $_POST['option_qty'];
}else{ $qty=""; } }else{ $qty=""; }
if(isset($_POST['max_qty'])){
$max_qty = $_POST['max_qty'];
}else{ $max_qty=""; }
if(isset($_POST['option_price'])){ if(isset($_POST['option_price'])){
$price = $_POST['option_price']; $price = $_POST['option_price'];
@ -49,12 +53,43 @@ function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id,
if ( $qty[$i] != '' ) : if ( $qty[$i] != '' ) :
$new[$i]['option_qty'] = stripslashes( strip_tags( $qty[$i] ) ); $new[$i]['option_qty'] = stripslashes( strip_tags( $qty[$i] ) );
endif; endif;
if ( $max_qty[$i] != '' ) :
$new[$i]['max_qty'] = stripslashes( strip_tags( $max_qty[$i] ) );
endif;
$opttprice = ($price[$i]*$qty[$i]); $opttprice = ($price[$i]*$qty[$i]);
$tp = ($tp+$opttprice); $tp = ($tp+$opttprice);
} }
} }
$extra_service_name = isset($_POST['event_extra_service_name']) ? mage_array_strip($_POST['event_extra_service_name']) : array();
$extra_service_qty = isset($_POST['event_extra_service_qty'])? mage_array_strip($_POST['event_extra_service_qty']):array();
$extra_service_price = isset($_POST['event_extra_service_price'])? mage_array_strip($_POST['event_extra_service_price']):array();
if($extra_service_name){
for ( $i = 0; $i < count($extra_service_name); $i++ ) {
if($extra_service_qty[$i] > 0){
if ( $extra_service_name[$i] != '' ) :
$event_extra[$i]['service_name'] = stripslashes( strip_tags( $extra_service_name[$i] ) );
endif;
if ( $extra_service_price[$i] != '' ) :
$event_extra[$i]['service_price'] = stripslashes( strip_tags( $extra_service_price[$i] ) );
endif;
if ( $extra_service_qty[$i] != '' ) :
$event_extra[$i]['service_qty'] = stripslashes( strip_tags( $extra_service_qty[$i] ) );
endif;
}
$extprice = ($extra_service_price[$i]*$extra_service_qty[$i]);
$tp = ($tp+$extprice);
}
}
if(isset($_POST['mep_event_ticket_type'])){ if(isset($_POST['mep_event_ticket_type'])){
@ -68,6 +103,12 @@ if(isset($_POST['mep_event_ticket_type'])){
$tp = $tp+$ticket_type_price; $tp = $tp+$ticket_type_price;
} }
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' ); $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
if($form_position=='details_page'){ if($form_position=='details_page'){
$user = mep_save_attendee_info_into_cart($product_id); $user = mep_save_attendee_info_into_cart($product_id);
@ -107,26 +148,6 @@ if(isset($_POST['mep_event_ticket_type'])){
} }
} }
$mep_events_extra_prices = get_post_meta($product_id, 'mep_events_extra_prices', true) ? get_post_meta($product_id, 'mep_events_extra_prices', true) : array();
$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_validate_info'] = $validate; $cart_item_data['event_validate_info'] = $validate;
@ -135,7 +156,7 @@ foreach($mep_events_extra_prices as $extra_service){
$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_extra_service'] = $event_extra;
$cart_item_data['event_cart_location'] = $event_cart_location; $cart_item_data['event_cart_location'] = $event_cart_location;
$cart_item_data['event_cart_date'] = $mep_event_start_date; $cart_item_data['event_cart_date'] = $mep_event_start_date;
// $cart_item_data['event_cart_date'] = $event_cart_date; // $cart_item_data['event_cart_date'] = $event_cart_date;
@ -176,10 +197,10 @@ $eid = $cart_item['event_id'];
if (get_post_type($eid) == 'mep_events') { if (get_post_type($eid) == 'mep_events') {
$user_info = $cart_item['event_user_info']; $user_info = $cart_item['event_user_info'];
$ticket_type_arr = $cart_item['event_ticket_info']; $ticket_type_arr = $cart_item['event_ticket_info'];
$event_extra_service = $cart_item['event_extra_service'];
echo "<ul class='event-custom-price'>"; echo "<ul class='event-custom-price'>";
if(is_array($user_info) && sizeof($user_info) > 0){ if(is_array($user_info) && sizeof($user_info) > 0){
foreach($user_info as $userinf){ foreach($user_info as $userinf){
@ -195,19 +216,22 @@ if(is_array($user_info) && sizeof($user_info) > 0){
?> ?>
<li><?php _e('Event Location','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; //echo $cart_item['event_ticket_type']; ?></li> <li><?php _e('Event Location','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; //echo $cart_item['event_ticket_type']; ?></li>
<?php <?php
if($mep_events_extra_prices){
foreach ( $mep_events_extra_prices as $field ) { if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
if($field['option_qty']>0){ foreach($ticket_type_arr as $ticket){
?> echo '<li>'.$ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = '.wc_price($ticket['ticket_price'] * $ticket['ticket_qty']).'</li>';
<li><?php echo esc_attr( $field['option_name'] ); ?> x <?php echo esc_attr( $field['option_qty'] ); ?>: <?php echo wc_price($field['option_qty'] *$field['option_price'] ); ?> </li>
<?php
} }
}
} }
if(array_key_exists('event_ticket_type', $cart_item)){
// if($cart_item['event_ticket_type']){ if(is_array($event_extra_service) && sizeof($event_extra_service) > 0){
echo "<li> Ticket: ".$cart_item['event_ticket_type']." x ".$cart_item['event_ticket_qty'].": ".wc_price($cart_item['event_ticket_price'])."</li>"; foreach($event_extra_service as $extra_service){
echo '<li>'.$extra_service['service_name']." - ".wc_price($extra_service['service_price']).' x '.$extra_service['service_qty'].' = '.wc_price($extra_service['service_price'] * $extra_service['service_qty']).'</li>';
}
} }
echo "</ul>"; echo "</ul>";
} }
return $item_data; return $item_data;
@ -251,7 +275,7 @@ function mep_checkout_validation( $posted ) {
function mep_add_custom_fields_text_to_order_items( $item, $cart_item_key, $values, $order ) { 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') { if (get_post_type($eid) == 'mep_events') {
$mep_events_extra_prices = $values['event_extra_option']; $mep_events_extra_prices = $values['event_extra_option'];
if(isset($values['event_ticket_type'])){ if(isset($values['event_ticket_type'])){
$event_ticket_type = $values['event_ticket_type']; $event_ticket_type = $values['event_ticket_type'];
}else{ }else{
@ -290,7 +314,9 @@ if(isset($values['event_ticket_qty'])){
$product_id = $values['product_id']; $product_id = $values['product_id'];
$cart_location = $values['event_cart_location']; $cart_location = $values['event_cart_location'];
$event_extra_service = $values['event_extra_service'];
$ticket_type_arr = $values['event_ticket_info'];
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' ); $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
if($form_position=='details_page'){ if($form_position=='details_page'){
@ -307,33 +333,51 @@ $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec
$item->add_meta_data('Location',$cart_location); $item->add_meta_data('Location',$cart_location);
$item->add_meta_data('_event_ticket_info',$values['event_ticket_info']); $item->add_meta_data('_event_ticket_info',$values['event_ticket_info']);
if (is_array($mep_events_extra_prices) || is_object($mep_events_extra_prices)){ // if (is_array($mep_events_extra_prices) || is_object($mep_events_extra_prices)){
foreach ( $mep_events_extra_prices as $field ) { // foreach ( $mep_events_extra_prices as $field ) {
if($field['option_qty']>0){ // if($field['option_qty']>0){
$item->add_meta_data(esc_attr( $field['option_name'] )." x ".$field['option_qty'], wc_price($field['option_qty'] *$field['option_price'] ) ); // $item->add_meta_data(esc_attr( $field['option_name'] )." x ".$field['option_qty'], wc_price($field['option_qty'] *$field['option_price'] ) );
// $opt_name = $product_id.str_replace(' ', '', $field['option_name']); // // $opt_name = $product_id.str_replace(' ', '', $field['option_name']);
// $opt_qty = $field['option_qty']; // // $opt_qty = $field['option_qty'];
// $tes = get_post_meta($product_id,"mep_xtra_$opt_name",true); // // $tes = get_post_meta($product_id,"mep_xtra_$opt_name",true);
// $ntes = ($tes+$opt_qty); // // $ntes = ($tes+$opt_qty);
// update_post_meta( $product_id, "mep_xtra_$opt_name",$ntes); // // update_post_meta( $product_id, "mep_xtra_$opt_name",$ntes);
// }
// }
// }
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
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']);
$item->add_meta_data($ticket_type_name, $ticket_type_val );
} }
}
} }
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']);
$item->add_meta_data($service_type_name, $service_type_val );
}
}
if($event_ticket_type){ if($event_ticket_type){
// $tck_name = $product_id.str_replace(' ', '', $event_ticket_type);
// $tesqt = get_post_meta($product_id,"mep_xtra_$tck_name",true); }else{
// $ntesqt = (int) ($tesqt+$event_ticket_qty);
// update_post_meta( $product_id, "mep_xtra_$tck_name",$ntesqt);
// $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('_event_user_info',$event_user_info);
$item->add_meta_data('_no_of_ticket',count($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_service_info',$mep_events_extra_prices);
$item->add_meta_data('event_id',$eid); $item->add_meta_data('event_id',$eid);
$item->add_meta_data('_product_id',$eid); $item->add_meta_data('_product_id',$eid);
$item->add_meta_data('_event_extra_service',$event_extra_service);
} }
} }

View File

@ -250,7 +250,7 @@ function mep_event_list($atts, $content = null)
} }
?> ?>
<?php if ($flex_column > 0 && $style == 'grid' && $mage_div_count % 3 == 0) { <?php if ($flex_column > 0 && $style == 'grid' && $mage_div_count % $flex_column == 0) {
echo '<div class="mage_grid_box">'; echo '<div class="mage_grid_box">';
} ?> } ?>
<div class='<?php echo $columnNumber; ?> mep_event_<?php echo $style; ?>_item mix <?php if ($tt) { <div class='<?php echo $columnNumber; ?> mep_event_<?php echo $style; ?>_item mix <?php if ($tt) {
@ -342,18 +342,18 @@ function mep_event_list($atts, $content = null)
</div> </div>
</div> </div>
<!-- <p>--><?php //echo count($args_search_qqq);?><!--</p>--> <!-- <p>--><?php //echo count($args_search_qqq);?><!--</p>-->
<?php <?php
if ($flex_column > 0 && $style == 'grid' && ($mage_div_count % 3 == 2 || $total_post-1 == $mage_div_count)) { $mage_div_count++;
if($total_post - $mage_div_count+1 < 3 && $total_post - $mage_div_count+1 >0){ if ($flex_column > 0 && $style == 'grid' && ($mage_div_count % $flex_column == 0 || $total_post == $mage_div_count)) {
$blank_div = $total_post - $mage_div_count +1 ; $blank_div = $flex_column - ($mage_div_count % $flex_column);
while ($blank_div > 0){ if ($total_post == $mage_div_count && $blank_div > 0 && $flex_column > 1 && $blank_div < $flex_column) {
while ($blank_div > 0) {
echo '<div class="blank_div"></div>'; echo '<div class="blank_div"></div>';
$blank_div--; $blank_div--;
} }
} }
echo '</div>'; echo '</div>';
} }
$mage_div_count++;
} }
wp_reset_postdata(); wp_reset_postdata();
//} //}

View File

@ -85,8 +85,7 @@ function mep_ev_datetime()
add_action('mep_event_date_default_theme', 'mep_date_in_default_theme'); add_action('mep_event_date_default_theme', 'mep_date_in_default_theme');
function mep_date_in_default_theme() function mep_date_in_default_theme(){
{
global $event_meta; global $event_meta;
$start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]; $start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0];
@ -146,11 +145,11 @@ function mep_date_in_default_theme()
} else { } else {
if (is_array($more_date) && sizeof($more_date) > 0) { if (is_array($more_date) && sizeof($more_date) > 0) {
?> ?>
<li><i class="fa fa-calendar"></i> Start : <?php echo get_mep_datetime($start_datetime, 'time'); ?> - <?php echo get_mep_datetime($start_datetime, 'date-text'); ?><br> <li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($start_datetime, 'date-text'); ?><br>
<i class="fa fa-calendar"></i> End : <?php if ($start_date != $end_date) { <i class="fa fa-clock-o"></i> <?php echo get_mep_datetime($start_datetime, 'time'); ?> <?php if($start_date != $end_date) {
echo get_mep_datetime($end_datetime, 'time') . ' - '; echo ' - '.get_mep_datetime($end_datetime, 'date-text');
} }
echo get_mep_datetime($end_datetime, 'date-text'); ?></li> echo ' - '.get_mep_datetime($end_datetime, 'time'); ?></li>
<?php <?php
@ -286,8 +285,7 @@ function mep_ev_time_ticket($event_meta)
mep_get_only_time($start_datetime); mep_get_only_time($start_datetime);
} }
function mep_ev_date_ticket($event_meta) function mep_ev_date_ticket($event_meta){
{
$start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]; $start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0]; $start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0]; $start_time = $event_meta['event_start_time'][0];

View File

@ -20,11 +20,11 @@ function mep_ev_extra_serv()
</tr> </tr>
<?php <?php
foreach ($mep_events_extra_prices as $field) { foreach ($mep_events_extra_prices as $field) {
$total_ext = (int)$field['option_qty']; $event_date = get_post_meta($post->ID, 'event_start_date', true).' '.get_post_meta($post->ID, 'event_start_time', true);
$opt_name = $pid . str_replace(' ', '', $field['option_name']); $total_extra_service = (int)$field['option_qty'];
$tes = (int)get_post_meta($pid, "mep_xtra_$opt_name", true);
$ext_left = ($total_ext - $tes);
$qty_type = $field['option_qty_type']; $qty_type = $field['option_qty_type'];
$total_sold = (int) mep_extra_service_sold(get_the_id(),$field['option_name'],$event_date);
$ext_left = ($total_extra_service - $total_sold);
?> ?>
<tr> <tr>
<td align="Left"><?php echo $field['option_name']; ?> <td align="Left"><?php echo $field['option_name']; ?>
@ -36,7 +36,7 @@ function mep_ev_extra_serv()
<?php <?php
if ($ext_left > 0) { if ($ext_left > 0) {
if ($qty_type == 'dropdown') { ?> if ($qty_type == 'dropdown') { ?>
<select name="option_qty[]" id="eventpxtp_<?php //echo $count; <select name="event_extra_service_qty[]" id="eventpxtp_<?php //echo $count;
?>" class='extra-qty-box'> ?>" class='extra-qty-box'>
<?php for ($i = 0; $i <= $ext_left; $i++) { ?> <?php for ($i = 0; $i <= $ext_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?><?php echo $field['option_name']; ?></option> <option value="<?php echo $i; ?>"><?php echo $i; ?><?php echo $field['option_name']; ?></option>
@ -44,7 +44,7 @@ function mep_ev_extra_serv()
</select> </select>
<?php } else { ?> <?php } else { ?>
<input id="eventpx" <?php //if($ext_left<=0){ echo "disabled"; } <input id="eventpx" <?php //if($ext_left<=0){ echo "disabled"; }
?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box' name='option_qty[]' data-price='<?php echo $field['option_price']; ?>' value='0' min="0" max="<?php echo $ext_left; ?>"> ?> size="4" pattern="[0-9]*" inputmode="numeric" type="number" class='extra-qty-box' name='event_extra_service_qty[]' data-price='<?php echo $field['option_price']; ?>' value='0' min="0" max="<?php echo $ext_left; ?>">
<?php } <?php }
} else { } else {
echo mep_get_option('mep_not_available_text', 'label_setting_sec') ? mep_get_option('mep_not_available_text', 'label_setting_sec') : _e('Not Available', 'mage-eventpress'); echo mep_get_option('mep_not_available_text', 'label_setting_sec') ? mep_get_option('mep_not_available_text', 'label_setting_sec') : _e('Not Available', 'mage-eventpress');
@ -53,8 +53,8 @@ function mep_ev_extra_serv()
<td class="mage_text_center"><?php echo wc_price($field['option_price']); <td class="mage_text_center"><?php echo wc_price($field['option_price']);
if ($ext_left > 0) { ?> if ($ext_left > 0) { ?>
<p style="display: none;" class="price_jq"><?php echo $field['option_price']; ?></p> <p style="display: none;" class="price_jq"><?php echo $field['option_price']; ?></p>
<input type="hidden" name='option_name[]' value='<?php echo $field['option_name']; ?>'> <input type="hidden" name='event_extra_service_name[]' value='<?php echo $field['option_name']; ?>'>
<input type="hidden" name='option_price[]' value='<?php echo $field['option_price']; ?>'> <input type="hidden" name='event_extra_service_price[]' value='<?php echo $field['option_price']; ?>'>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>

View File

@ -28,7 +28,8 @@ foreach ( $mep_event_ticket_type as $field ) {
$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_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_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'],''); $event_date = get_post_meta($post->ID, 'event_start_date', true).' '.get_post_meta($post->ID, 'event_start_time', true);
$total_sold = (int) mep_ticket_type_sold(get_the_id(),$field['option_name_t'],$event_date);
$total_left = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity); $total_left = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity);
?> ?>
<tr> <tr>
@ -41,16 +42,23 @@ $total_left = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_qua
</span> </span>
<?php <?php
if($total_left>0){ if($total_left>0){
if($qty_t_type=='dropdown'){ ?> if($qty_t_type=='dropdown'){ ?>
<select name="option_qty[]" id="eventpxtp_<?php echo $count; ?>" <?php if($total_left<=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 <= $total_left; $i++) { ?> <?php
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option> if (is_plugin_active('woocommerce-event-manager-min-max-quantity-addon/mep_min_max_qty.php')){
<?php } ?> do_action('min_max_data_execute', $field, $total_left, $pid, get_current_user_id());
}else{
for ($i = 0; $i <= $total_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option>
<?php }} ?>
</select> </select>
<?php }else{ ?> <?php }else{ ?>
<?php if (is_plugin_active('woocommerce-event-manager-min-max-quantity-addon/mep_min_max_qty.php')){
do_action('min_max_data_number_type', $field, $total_left, $pid, get_current_user_id(), $count);
}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($total_left,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">
@ -60,6 +68,7 @@ if($qty_t_type=='dropdown'){ ?>
<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']; ?>'>
<input type="hidden" name='max_qty[]' value='<?php echo $field['option_max_qty']; ?>'>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>

View File

@ -19,7 +19,7 @@ if($location_sts){
if($event_meta['mep_sgm'][0]){
if($map_type=='iframe'){ if($map_type=='iframe'){
?> ?>
@ -33,7 +33,7 @@ if($map_type=='iframe'){
if($event_meta['mep_sgm'][0]){ if($user_api){ ?> if($user_api){ ?>
<div class="mep-gmap-sec"> <div class="mep-gmap-sec">
<div id="map" class='mep_google_map'></div> <div id="map" class='mep_google_map'></div>
</div> </div>

View File

@ -230,7 +230,6 @@ A. you can create support ticket here with problem details with possible screens
= 1.0.2 = = 1.0.2 =
*Quantity Manage Added - 14 February 2018* *Quantity Manage Added - 14 February 2018*
= 1.0.5 = = 1.0.5 =
*Update Release, Google Map and Add to calender feture added and some bug fixed - 22 February 2018* *Update Release, Google Map and Add to calender feture added and some bug fixed - 22 February 2018*
@ -276,35 +275,30 @@ A. you can create support ticket here with problem details with possible screens
= 2.1.5 = = 2.1.5 =
*Update Release, Fixed Google Calender Time issue fixed. 06 Nov 2018 *Update Release, Fixed Google Calender Time issue fixed. 06 Nov 2018
*= 2.1.6 = = 2.1.6 =
*Update Release, Event Expired Listing Query Issue has been fixed in this version.. 06 Nov 2018* *Update Release, Event Expired Listing Query Issue has been fixed in this version.. 06 Nov 2018*
*= 2.1.9 = = 2.1.9 =
*Update Release, Custom email sending issue has been fixed. 28 Nov 2018* *Update Release, Custom email sending issue has been fixed. 28 Nov 2018*
*= 2.2.0 = = 2.2.0 =
*Update Release, Fixed no numeric error, and add feature to hide available seat count. 29 Nov 2018* *Update Release, Fixed no numeric error, and add feature to hide available seat count. 29 Nov 2018*
*= 2.2.1 & 2.2.2 = = 2.2.1 & 2.2.2 =
*Update Release, fixed cart wrong calculation issue. 02 Dec 2018* *Update Release, fixed cart wrong calculation issue. 02 Dec 2018*
*= 2.2.3 = = 2.2.3 =
*Update Release: *Update Release:
==> Added custom excerpt option into event Added custom excerpt option into event, Fix zero amount add to cart issue, Showing Not Ticket available message when all tickets sold out, Price Label settings has been added into Event Settings. 02 Dec 2018*
==> Fix zero amount add to cart issue
==> Showing Not Ticket available message when all tickets sold out
==> Price Label settings has been added into Event Settings
02 Dec 2018*
= 2.2.6 =
*= 2.2.6 =
*Update Release: *Update Release:
==> Translation ready ==> Translation ready
==> Bangla language fully supported ==> Bangla language fully supported
==> NL language fully supported ==> NL language fully supported
18 Dec 2018* 18 Dec 2018*
*= 2.3.1 = = 2.3.1 =
*Update Release: *Update Release:
==> PDF Ticket New Design ==> PDF Ticket New Design
==> Now you can add custom image as background of PDF Ticket ==> Now you can add custom image as background of PDF Ticket
@ -313,33 +307,30 @@ A. you can create support ticket here with problem details with possible screens
==> Add to cart Button issue fixed. ==> Add to cart Button issue fixed.
31 Jan 2019* 31 Jan 2019*
= 2.3.2 =
*= 2.3.2 =
*Update Release: *Update Release:
==> France Language Pack Ready. ==> France Language Pack Ready.
05 Feb 2019* 05 Feb 2019*
= 2.5.8 =
*= 2.5.8 =
*Update Release: *Update Release:
==> Security Vulnerability Issue Fixed. ==> Security Vulnerability Issue Fixed.
28 April 2019* 28 April 2019*
*= 2.6 = = 2.6 =
*Update Release: *Update Release:
==> CSV Blank issue fixed ==> CSV Blank issue fixed
==> Multiple Add Calender feature added. ==> Multiple Add Calender feature added.
21 May 2019* 21 May 2019*
*= 2.6.1 = = 2.6.1 =
*Update Release: *Update Release:
==> Templating issue fixed in child theme ==> Templating issue fixed in child theme
03 June 2019* 03 June 2019*
= 2.6.2 & 2.6.3 =
*= 2.6.2 & 2.6.3 =
*Update Release: *Update Release:
==> Calendar Button issue fixed ==> Calendar Button issue fixed
==> Calendar Button label text issue fixed ==> Calendar Button label text issue fixed
@ -348,133 +339,126 @@ A. you can create support ticket here with problem details with possible screens
==> Dynamic Column feature in CSV file ==> Dynamic Column feature in CSV file
11 June 2019* 11 June 2019*
= 2.6.4 =
*= 2.6.4 =
*Update Release: *Update Release:
==> Booking counting duplicating issue fixed in free event. ==> Booking counting duplicating issue fixed in free event.
==> Add new feature Reset Booking count option. ==> Add new feature Reset Booking count option.
19 June 2019* 19 June 2019*
= 2.6.5 =
*= 2.6.5 =
*Update Release: *Update Release:
==> Fixed Security issue in Attandee Page ==> Fixed Security issue in Attandee Page
15 June 2019* 15 June 2019*
= 2.6.6 =
*= 2.6.6 =
*Update Release: *Update Release:
==> Added new strings into Translation setting page ==> Added new strings into Translation setting page
==> Fixed event details page not showing in some theme issue ==> Fixed event details page not showing in some theme issue
==> Mixitup Filter for multiple sub category issue fixed ==> Mixitup Filter for multiple sub category issue fixed
1 July 2019* 1 July 2019*
= 2.6.7 =
*= 2.6.7 =
* Update Release: * Update Release:
==> Timezone issue fixed ==> Timezone issue fixed
==> Added Event expire date change settings ==> Added Event expire date change settings
==> Negative value display issue fixed. ==> Negative value display issue fixed.
3 July 2019* 3 July 2019*
= 2.6.8 =
*= 2.6.8 =
* Update Release: * Update Release:
==> Quick fix, Double booking issue fixed. ==> Quick fix, Double booking issue fixed.
5 July 2019* 5 July 2019*
= 2.6.9 =
*= 2.6.9 =
* Update Release: * Update Release:
==> PHP warning fixed ==> PHP warning fixed
==> Date Display ==> Date Display
18 July 2019* 18 July 2019*
= 2.7.0 =
*= 2.7.0 =
* Update Release: * Update Release:
==> Removed Single Price Section ==> Removed Single Price Section
==> Added missing values into product set_props ==> Added missing values into product set_props
01 Aug 2019* 01 Aug 2019*
= 2.7.1 =
*= 2.7.1 =
* Update Release: * Update Release:
==> Removed Organizer address php warning issue in dashboard ==> Removed Organizer address php warning issue in dashboard
==> Fix woocomerce product showing warning issue in the thankyou page ==> Fix woocomerce product showing warning issue in the thankyou page
07 Aug 2019* 07 Aug 2019*
= 2.7.2 =
*= 2.7.2 =
* Update Release: * Update Release:
==> Bug Fixed ==> Bug Fixed
15 Sep 2019* 15 Sep 2019*
= 2.7.3 =
*= 2.7.3 =
* Update Release: * Update Release:
==> Bug Fixed ==> Bug Fixed*
*
= 2.8.0 =
*= 2.8.0 =
* Update Release: * Update Release:
==> Bug Fixed ==> Bug Fixed
==> Event seating issue fixed while order status chganged ==> Event seating issue fixed while order status chganged
04 Nov 2019* 04 Nov 2019*
= 3.0.0 =
*= 3.0.0 =
* Update Release: * Update Release:
==> Code Improved ==> Code Improved
==> Facebook For Woocommerce Issue Fixed ==> Facebook For Woocommerce Issue Fixed
==> Bug Fixed ==> Bug Fixed
10 Dec 2019* 10 Dec 2019*
= 3.0.1 =
*= 3.0.1 =
* Update Release: * Update Release:
==> Shortcode not showing issue fixed ==> Shortcode not showing issue fixed
==> Timezone issue fixed. ==> Timezone issue fixed.
==> Time Format issue fixed. ==> Time Format issue fixed.
15 Dec 2019* 15 Dec 2019*
= 3.0.2 =
*= 3.0.2 =
* Update Release: * Update Release:
==> Add Calendar Button issue fixed ==> Add Calendar Button issue fixed
==> Event Checkout Validation ==> Event Checkout Validation
==> Missing Translation added. ==> Missing Translation added.
17 Dec 2019* 17 Dec 2019*
= 3.0.3 =
*= 3.0.3 =
* Update Release: * Update Release:
==> Code Improved ==> Code Improved
==> Date Issue Fixed in Some template and organizer page & PDF Ticket ==> Date Issue Fixed in Some template and organizer page & PDF Ticket
==> Email HTML support issue fixed ==> Email HTML support issue fixed
02 Jan 2020* 02 Jan 2020*
= 3.0.5 =
*= 3.0.5 =
* Update Release: * Update Release:
==> Code Improved ==> Code Improved
==> Date Issue Fixed in Event List ==> Date Issue Fixed in Event List
==> Email HTML support issue fixed ==> Email HTML support issue fixed
15 Jan 2020* 15 Jan 2020*
*= 3.0.6 = = 3.0.6 =
* Update Release: * Update Release:
==> Code Improved ==> Code Improved
==> Design Issue Fixed ==> Design Issue Fixed
==> Template Missing issue fixed ==> Template Missing issue fixed
22 Jan 2020* 22 Jan 2020*
= 3.0.7 =
*= 3.0.7 =
* Update Release: * Update Release:
==> Design Issue Fixed ==> Design Issue Fixed
==> Event Image is Cart not Showing issue fixed ==> Event Image is Cart not Showing issue fixed
==> Event List Last item broken issue fixed ==> Event List Last item broken issue fixed
23 Jan 2020* 23 Jan 2020*
= 3.0.8 =
* Update Release:
==> Design Issue Fixed
==> Extra Service Intentory System Added
==> Cart Display Information Improved
==> Tax Issue solved
==> Google Map Display Issue fixed
==> Cart Message Display issue fixed in Event Details Page
==> Event Date Wrong Icon issue fixed
==> Event Date removed start & end text from first date
29 Jan 2020*

View File

@ -30,6 +30,7 @@ $currency_pos = get_option( 'woocommerce_currency_pos' );
?> ?>
<div class="mep-events-wrapper"> <div class="mep-events-wrapper">
<?php do_action( 'woocommerce_before_single_product' ); ?>
<?php <?php
require_once(dirname(__FILE__) . "/themes/$_current_template"); ?> require_once(dirname(__FILE__) . "/themes/$_current_template"); ?>
</div> </div>
@ -214,11 +215,6 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
}); });
<?php <?php
$count++; $count++;
} }

View File

@ -32,7 +32,10 @@ $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); $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'];
global $wpdb;
echo old_order_check($pid, get_current_user_id(), $field['option_name_t'])
?>
<?php if($mep_available_seat=='on'){ ?><div class="xtra-item-left"><?php echo max($total_left,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">
@ -43,12 +46,18 @@ $total_left = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_qua
<?php <?php
if($total_left>0){ if($total_left>0){
if($qty_t_type=='dropdown'){ ?> if($qty_t_type=='dropdown'){ ?>
<select name="option_qty[]" id="eventpxtp_<?php echo $count; ?>" <?php if($total_left<=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 <= $total_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option> <?php
<?php } ?> if (function_exists('old_order_check')){
</select> do_action('min_max_data_execute', $field, $total_left, $pid, get_current_user_id());
<?php }else{ ?> }else{
for ($i = 0; $i <= $total_left; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?> <?php _e('Ticket','mage-eventpress'); ?></option>
<?php }} ?>
</select>
<?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($total_left,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>
@ -60,6 +69,7 @@ if($qty_t_type=='dropdown'){ ?>
<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']; ?>'>
<input type="hidden" name='max_qty[]' value='<?php echo $field['option_max_qty']; ?>'>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>

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: 3.0.7 * Version: 3.0.8
* 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
@ -350,6 +350,7 @@ if($type == 'billing'){
$phone = isset($order_meta['_billing_phone'][0]) ? $order_meta['_billing_phone'][0] : ''; $phone = isset($order_meta['_billing_phone'][0]) ? $order_meta['_billing_phone'][0] : '';
$ticket_type = $_user_info['ticket_name']; $ticket_type = $_user_info['ticket_name'];
$event_date = $_user_info['event_date']; $event_date = $_user_info['event_date'];
$ticket_qty = $_user_info['ticket_qty'];
}elseif($type == 'user_form'){ }elseif($type == 'user_form'){
@ -365,6 +366,7 @@ if($type == 'billing'){
$vegetarian = $_user_info['user_vegetarian']; $vegetarian = $_user_info['user_vegetarian'];
$tshirtsize = $_user_info['user_tshirtsize']; $tshirtsize = $_user_info['user_tshirtsize'];
$ticket_type = $_user_info['user_ticket_type']; $ticket_type = $_user_info['user_ticket_type'];
$ticket_qty = $_user_info['user_ticket_qty'];
$event_date = $_user_info['user_event_date']; $event_date = $_user_info['user_event_date'];
$event_id = $_user_info['user_event_id'] ? $_user_info['user_event_id'] : $event_id; $event_id = $_user_info['user_event_id'] ? $_user_info['user_event_id'] : $event_id;
$mep_ucf = isset($_user_info['mep_ucf']) ? $_user_info['mep_ucf'] : ""; $mep_ucf = isset($_user_info['mep_ucf']) ? $_user_info['mep_ucf'] : "";
@ -384,26 +386,32 @@ $new_post = array(
//SAVE THE POST //SAVE THE POST
$pid = wp_insert_post($new_post); $pid = wp_insert_post($new_post);
$pin = $user_id.$order_id.$event_id.$pid; $pin = $user_id.$order_id.$event_id.$pid;
update_post_meta( $pid, 'ea_name', $uname); update_post_meta( $pid, 'ea_name', $uname );
update_post_meta( $pid, 'ea_address_1', $address); update_post_meta( $pid, 'ea_address_1', $address );
update_post_meta( $pid, 'ea_email', $email); update_post_meta( $pid, 'ea_email', $email );
update_post_meta( $pid, 'ea_phone', $phone); update_post_meta( $pid, 'ea_phone', $phone );
update_post_meta( $pid, 'ea_gender', $gender); update_post_meta( $pid, 'ea_gender', $gender );
update_post_meta( $pid, 'ea_company', $company); update_post_meta( $pid, 'ea_company', $company );
update_post_meta( $pid, 'ea_desg', $designation); update_post_meta( $pid, 'ea_desg', $designation );
update_post_meta( $pid, 'ea_website', $website); update_post_meta( $pid, 'ea_website', $website );
update_post_meta( $pid, 'ea_vegetarian', $vegetarian); update_post_meta( $pid, 'ea_vegetarian', $vegetarian );
update_post_meta( $pid, 'ea_tshirtsize', $tshirtsize); update_post_meta( $pid, 'ea_tshirtsize', $tshirtsize );
update_post_meta( $pid, 'ea_ticket_type', $ticket_type); update_post_meta( $pid, 'ea_ticket_type', $ticket_type );
update_post_meta( $pid, 'ea_payment_method', $payment_method); update_post_meta( $pid, 'ea_ticket_qty', $ticket_qty);
update_post_meta( $pid, 'ea_event_name', get_the_title($event_id)); update_post_meta( $order_id, 'ea_ticket_qty', $ticket_qty);
update_post_meta( $pid, 'ea_event_id', $event_id); update_post_meta( $order_id, 'ea_ticket_type', $ticket_type );
update_post_meta( $pid, 'ea_order_id', $order_id); update_post_meta( $order_id, 'ea_event_id', $event_id );
update_post_meta( $pid, 'ea_user_id', $user_id); update_post_meta( $pid, 'ea_payment_method', $payment_method );
update_post_meta( $pid, 'ea_ticket_no', $pin); update_post_meta( $pid, 'ea_event_name', get_the_title( $event_id ) );
update_post_meta( $pid, 'ea_event_date', $event_date); update_post_meta( $pid, 'ea_event_id', $event_id );
update_post_meta( $pid, 'ea_order_status', $order_status); update_post_meta( $pid, 'ea_order_id', $order_id );
update_post_meta( $pid, 'ea_user_id', $user_id );
update_post_meta( $order_id, 'ea_user_id', $user_id );
update_post_meta( $pid, 'ea_ticket_no', $pin );
update_post_meta( $pid, 'ea_event_date', $event_date );
update_post_meta( $pid, 'ea_order_status', $order_status );
update_post_meta( $order_id, 'ea_order_status', $order_status );
// Checking if the form builder addon is active and have any custom fields // 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); $mep_form_builder_data = get_post_meta($event_id, 'mep_form_builder_data', true);
@ -415,6 +423,70 @@ $new_post = array(
} }
// add_action('admin_init','ttest');
function ttest(){
mep_attendee_extra_service_create(11289,8938);
}
function mep_attendee_extra_service_create($order_id,$event_id){
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
$order_status = $order->get_status();
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
}
$_event_extra_service = wc_get_order_item_meta($item_id,'_event_extra_service',true);
$date = date('Y-m-d H:i:s',strtotime(wc_get_order_item_meta($item_id,'Date',true)));
if(is_array($_event_extra_service) && sizeof($_event_extra_service) > 0){
foreach($_event_extra_service as $extra_serive){
$uname = 'Extra Service for '.get_the_title($event_id).' Order #'.$order_id;
// echo $extra_serive['service_price'];
// die();
$new_post = array(
'post_title' => $uname,
'post_content' => '',
'post_category' => array(),
'tags_input' => array(),
'post_status' => 'publish',
'post_type' => 'mep_extra_service'
);
$pid = wp_insert_post($new_post);
update_post_meta( $pid, 'ea_extra_service_name', $extra_serive['service_name'] );
update_post_meta( $pid, 'ea_extra_service_qty', $extra_serive['service_qty'] );
update_post_meta( $pid, 'ea_extra_service_unit_price', $extra_serive['service_price'] );
update_post_meta( $pid, 'ea_extra_service_total_price', $extra_serive['service_qty'] * $extra_serive['service_price'] );
update_post_meta( $pid, 'ea_extra_service_event', $event_id );
update_post_meta( $pid, 'ea_extra_service_order', $order_id );
update_post_meta( $pid, 'ea_extra_service_order_status', $order_status );
update_post_meta( $pid, 'ea_extra_service_event_date', $date );
}
}
}
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10); add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10);
@ -444,6 +516,7 @@ if($form_position=='checkout_page'){
$service_info_arr = wc_get_order_item_meta($item_id,'_event_service_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); $event_ticket_info_arr = wc_get_order_item_meta($item_id,'_event_ticket_info',true);
$item_quantity = 0; $item_quantity = 0;
foreach ( $event_ticket_info_arr as $field ) { foreach ( $event_ticket_info_arr as $field ) {
if($field['ticket_qty']>0){ if($field['ticket_qty']>0){
@ -472,7 +545,7 @@ if($form_position=='checkout_page'){
$service_info_arr = wc_get_order_item_meta($item_id,'_event_service_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); $event_ticket_info_arr = wc_get_order_item_meta($item_id,'_event_ticket_info',true);
$item_quantity = 0; $item_quantity = 0;
mep_attendee_extra_service_create($order_id,$event_id);
foreach ( $event_ticket_info_arr as $field ) { foreach ( $event_ticket_info_arr as $field ) {
if($field['ticket_qty']>0){ if($field['ticket_qty']>0){
$item_quantity = $item_quantity + $field['ticket_qty']; $item_quantity = $item_quantity + $field['ticket_qty'];
@ -545,9 +618,36 @@ function change_attandee_order_status($order_id,$set_status,$post_status,$qr_sta
$tid = array(); $tid = array();
foreach ($loop->posts as $ticket) { foreach ($loop->posts as $ticket) {
$post_id = $ticket->ID; $post_id = $ticket->ID;
if(!empty($qr_status)){
update_post_meta($post_id, 'ea_order_status', $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);
}
}
function change_extra_service_status($order_id,$set_status,$post_status,$qr_status=null){
$args = array (
'post_type' => array( 'mep_extra_service' ),
'posts_per_page' => -1,
'post_status' => $post_status,
'meta_query' => array(
array(
'key' => 'ea_extra_service_order',
'value' => $order_id,
'compare' => '='
)
)
);
$loop = new WP_Query($args);
$tid = array();
foreach ($loop->posts as $ticket) {
$post_id = $ticket->ID;
update_post_meta($post_id, 'ea_extra_service_order_status', $qr_status);
$current_post = get_post( $post_id, 'ARRAY_A' ); $current_post = get_post( $post_id, 'ARRAY_A' );
$current_post['post_status'] = $set_status; $current_post['post_status'] = $set_status;
wp_update_post($current_post); wp_update_post($current_post);
@ -595,6 +695,7 @@ function mep_addendee_trash( $post_id ) {
if ( $post_type == 'shop_order' ) { if ( $post_type == 'shop_order' ) {
change_attandee_order_status( $post_id, 'trash', 'publish', '' ); change_attandee_order_status( $post_id, 'trash', 'publish', '' );
change_extra_service_status( $post_id, 'trash', 'publish', '' );
} }
@ -615,6 +716,7 @@ function mep_addendee_untrash( $post_id ) {
$order = wc_get_order( $post_id ); $order = wc_get_order( $post_id );
$order_status = $order->get_status(); $order_status = $order->get_status();
change_attandee_order_status( $post_id, 'publish', 'trash', '' ); change_attandee_order_status( $post_id, 'publish', 'trash', '' );
change_extra_service_status( $post_id, 'publish', 'trash', '' );
} }
if ( $post_type == 'mep_events' ) { if ( $post_type == 'mep_events' ) {
@ -644,11 +746,17 @@ function mep_attendee_status_update($order_id, $from_status, $to_status, $order
if($order->has_status( 'processing' ) ) { if($order->has_status( 'processing' ) ) {
change_attandee_order_status($order_id,'publish','trash','processing'); change_attandee_order_status($order_id,'publish','trash','processing');
change_attandee_order_status($order_id,'publish','publish','processing'); change_attandee_order_status($order_id,'publish','publish','processing');
change_extra_service_status($order_id,'publish','trash','processing');
change_extra_service_status($order_id,'publish','publish','processing');
} }
if($order->has_status( 'pending' )) { if($order->has_status( 'pending' )) {
change_attandee_order_status($order_id,'publish','trash','pending'); change_attandee_order_status($order_id,'publish','trash','pending');
change_attandee_order_status($order_id,'publish','publish','pending'); change_attandee_order_status($order_id,'publish','publish','pending');
change_extra_service_status($order_id,'publish','trash','pending');
change_extra_service_status($order_id,'publish','publish','pending');
} }
if($order->has_status( 'on-hold' )) { if($order->has_status( 'on-hold' )) {
change_attandee_order_status($order_id,'publish','trash','on-hold'); change_attandee_order_status($order_id,'publish','trash','on-hold');
@ -657,16 +765,25 @@ function mep_attendee_status_update($order_id, $from_status, $to_status, $order
if($order->has_status( 'completed' ) ) { if($order->has_status( 'completed' ) ) {
mep_event_confirmation_email_sent($event_id,$email); mep_event_confirmation_email_sent($event_id,$email);
change_attandee_order_status($order_id,'publish','trash','completed'); change_attandee_order_status($order_id,'publish','trash','completed');
change_attandee_order_status($order_id,'publish','publish','completed'); change_attandee_order_status($order_id,'publish','publish','completed');
change_extra_service_status($order_id,'publish','trash','completed');
change_extra_service_status($order_id,'publish','publish','completed');
} }
if($order->has_status( 'cancelled' ) ) { if($order->has_status( 'cancelled' ) ) {
change_attandee_order_status($order_id,'trash','publish','cancelled'); change_attandee_order_status($order_id,'trash','publish','cancelled');
change_extra_service_status($order_id,'trash','publish','cancelled');
} }
if($order->has_status( 'refunded' ) ) { if($order->has_status( 'refunded' ) ) {
change_attandee_order_status($order_id,'trash','publish','refunded'); change_attandee_order_status($order_id,'trash','publish','refunded');
change_extra_service_status($order_id,'trash','publish','refunded');
} }
if($order->has_status( 'failed' ) ) { if($order->has_status( 'failed' ) ) {
change_attandee_order_status($order_id,'trash','publish','failed'); change_attandee_order_status($order_id,'trash','publish','failed');
change_extra_service_status($order_id,'trash','publish','failed');
} }
} // End of Post Type Check } // End of Post Type Check
} // End order item foreach } // End order item foreach
@ -674,7 +791,9 @@ function mep_attendee_status_update($order_id, $from_status, $to_status, $order
} // End Function } // End Function
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;
@ -692,7 +811,7 @@ $ordr_total = $order->get_total();
$product_id = mep_event_get_order_meta($item_id,'_product_id'); $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') {
@ -1250,18 +1369,25 @@ $event_id = get_post_meta( get_the_id(), 'ea_event_id', true );
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]); $time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date('Y-m-d H:i:s',$time); $newformat = date('Y-m-d H:i:s',$time);
$order_array = array('processing', 'completed');
$order_status = get_post_meta(get_the_ID(), 'ea_order_status', true);
if(time() < strtotime($newformat)){ if ( time() < strtotime( $newformat ) ) {
?> ?>
<tr> <tr>
<td><?php echo get_post_meta( get_the_id(), 'ea_name', true ); ?></td> <td><?php echo get_post_meta( get_the_id(), 'ea_name', true ); ?></td>
<td><?php echo get_post_meta( get_the_id(), 'ea_ticket_type', true ); ?></td> <td><?php echo get_post_meta( get_the_id(), 'ea_ticket_type', true ); ?></td>
<td><?php echo get_post_meta( get_the_id(), 'ea_event_name', true ); ?></td> <td><?php echo get_post_meta( get_the_id(), 'ea_event_name', true ); ?></td>
<td><a href="<?php the_permalink(); ?>"><?php _e('Download','mage-eventpress'); ?></a></td> <?php if (in_array($order_status, $order_array)){ ?>
</tr> <td><a href="<?php the_permalink(); ?>"><?php _e( 'Download', 'mage-eventpress' ); ?></a>
<?php </td>
} <?php }else{ ?>
<td></td>
<?php } ?>
</tr>
<?php
}
} }
?> ?>
</table> </table>
@ -1382,6 +1508,7 @@ $user_info_arr = wc_get_order_item_meta($item_id,'_event_user_info',true);
$vegetarian = $_user_info['user_vegetarian']; $vegetarian = $_user_info['user_vegetarian'];
$tshirtsize = $_user_info['user_tshirtsize']; $tshirtsize = $_user_info['user_tshirtsize'];
$ticket_type = $_user_info['user_ticket_type']; $ticket_type = $_user_info['user_ticket_type'];
$ticket_qty = $_user_info['user_ticket_qty'];
?> ?>
<tr><td><?php echo $uname; ?></td><td><?php echo $address; ?></td></tr> <tr><td><?php echo $uname; ?></td><td><?php echo $address; ?></td></tr>
<?php <?php
@ -1770,7 +1897,13 @@ function mep_save_attendee_info_into_cart($product_id){
if(isset($_POST['mep_event_id'])){ if(isset($_POST['mep_event_id'])){
$mep_event_id = $_POST['mep_event_id']; $mep_event_id = $_POST['mep_event_id'];
}else{ $mep_event_id=""; } }else{ $mep_event_id=""; }
if ( isset( $_POST['option_qty'] ) ) {
$mep_user_option_qty = $_POST['option_qty'];
} else {
$mep_user_option_qty = "";
}
@ -1844,7 +1977,11 @@ function mep_save_attendee_info_into_cart($product_id){
if (isset($mep_event_id[$iu])) : if (isset($mep_event_id[$iu])) :
$user[$iu]['user_event_id'] = stripslashes( strip_tags( $mep_event_id[$iu] ) ); $user[$iu]['user_event_id'] = stripslashes( strip_tags( $mep_event_id[$iu] ) );
endif; endif;
if ( isset( $mep_user_option_qty[ $iu ] ) ) :
$user[ $iu ]['user_ticket_qty'] = stripslashes( strip_tags( $mep_user_option_qty[ $iu ] ) );
endif;
$mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true); $mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true);
@ -2005,8 +2142,8 @@ function mep_get_term_as_class($post_id,$taxonomy){
} }
function mep_ticket_type_sold($event_id,$type,$date){ function mep_ticket_type_sold($event_id,$type,$date=''){
//echo $date; if($date){
$args = array( $args = array(
'post_type' => 'mep_events_attendees', 'post_type' => 'mep_events_attendees',
'posts_per_page' => -1, 'posts_per_page' => -1,
@ -2044,12 +2181,100 @@ function mep_ticket_type_sold($event_id,$type,$date){
) )
) )
) )
); );
}else{
$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); $loop = new WP_Query($args);
return $loop->post_count; return $loop->post_count;
} }
function mep_extra_service_sold($event_id,$type,$date){
//echo $date;
$args = array(
'post_type' => 'mep_extra_service',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => 'ea_extra_service_event',
'value' => $event_id,
'compare' => '='
),
array(
'key' => 'ea_extra_service_name',
'value' => $type,
'compare' => '='
),
array(
'key' => 'ea_extra_service_event_date',
'value' => $date,
'compare' => 'LIKE'
)
),array(
'relation' => 'OR',
array(
'key' => 'ea_extra_service_order_status',
'value' => 'processing',
'compare' => '='
),
array(
'key' => 'ea_extra_service_order_status',
'value' => 'completed',
'compare' => '='
)
)
)
);
$loop = new WP_Query($args);
$count = 0;
foreach($loop->posts as $sold_service){
$pid = $sold_service->ID;
$count = $count + get_post_meta($pid,'ea_extra_service_qty',true);
}
return $count;
}
function mep_ticket_sold($event_id){ function mep_ticket_sold($event_id){
$args = array( $args = array(
@ -2232,6 +2457,17 @@ function mep_wc_link_product_on_save($post_id){
$product_id = get_post_meta($post_id,'link_wc_product',true) ? get_post_meta($post_id,'link_wc_product',true) : $post_id; $product_id = get_post_meta($post_id,'link_wc_product',true) ? get_post_meta($post_id,'link_wc_product',true) : $post_id;
set_post_thumbnail( $product_id, get_post_thumbnail_id($post_id) ); set_post_thumbnail( $product_id, get_post_thumbnail_id($post_id) );
wp_publish_post( $product_id );
$_tax_status = isset($_POST['_tax_status']) ? strip_tags($_POST['_tax_status']) : 'none';
$_tax_class = isset($_POST['_tax_class']) ? strip_tags($_POST['_tax_class']) : '';
$update__tax_status = update_post_meta( $product_id, '_tax_status', $_tax_status);
$update__tax_class = update_post_meta( $product_id, '_tax_class', $_tax_class);
// Update post // Update post
$my_post = array( $my_post = array(
@ -2256,7 +2492,7 @@ function mep_wc_link_product_on_save($post_id){
add_action('parse_query', 'product_tags_sorting_query'); // add_action('parse_query', 'product_tags_sorting_query');
function product_tags_sorting_query($query) { function product_tags_sorting_query($query) {
global $pagenow; global $pagenow;
@ -2427,7 +2663,17 @@ return $price;
// } // }
// } // }
function mage_array_strip($string, $allowed_tags = NULL){
if (is_array($string))
{
foreach ($string as $k => $v)
{
$string[$k] = mage_array_strip($v, $allowed_tags);
}
return $string;
}
return strip_tags($string, $allowed_tags);
}
}else{ }else{
function mep_admin_notice_wc_not_active() { function mep_admin_notice_wc_not_active() {