Version 3.0.0 released with major bug fixed

This commit is contained in:
magepeopleteam 2019-12-10 07:51:49 +00:00
parent dfc796c2eb
commit 4531a4be49
16 changed files with 2210 additions and 489 deletions

View File

@ -460,7 +460,7 @@ h3.mep_list_date i, .mep-list-footer ul li i{
}
.evl-cc {
width: 65%;
width: 85%;
float: left;
vertical-align: top;
text-align: left;
@ -1486,6 +1486,21 @@ p#mep_btn_notice {
margin: 0;
}
.related-event {
width: 30% !important;
margin-right: 3% !important;
}
.two_column{
width: 46% !important;
}
.three_column{
width: 30% !important;
margin-right: 3% !important;
}
.four_column{
width: 21% !important;
margin-right: 3% !important;
}

View File

@ -127,7 +127,8 @@ class MAGE_Events_Setting_Controls {
'default' => '12',
'options' => array(
'12' => '12 Hour',
'24' => '24 Hour'
'24' => '24 Hour',
'wtss' => 'WordPress TimeStamp Settings'
)
),
array(
@ -151,7 +152,170 @@ class MAGE_Events_Setting_Controls {
'mep_event_start_date' => 'Event Start Time',
'mep_event_end_date' => 'Event End Time'
)
),
array(
'name' => 'mep_event_hide_organizer_list',
'label' => __( 'Hide Organizer Section from list ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide organizer section from list.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_location_list',
'label' => __( 'Hide Location Section from list ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide location section from list.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_time_list',
'label' => __( 'Hide Full Time Section from list ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide time section from list.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_end_time_list',
'label' => __( 'Hide Only End Time Section from list ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide Only End Time section from list.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_date_from_details',
'label' => __( 'Hide Event Date Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide time section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_time_from_details',
'label' => __( 'Hide Event Time Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide time section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_location_from_details',
'label' => __( 'Hide Event Location Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide location section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_total_seat_from_details',
'label' => __( 'Hide Event Total Seat Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to hide Total Seat Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_event_by_from_details',
'label' => __( 'Hide Event by Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to Event by Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_address_from_details',
'label' => __( 'Hide Event Address Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to Event Address Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_event_schedule_details',
'label' => __( 'Hide Event Schedule Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to Event Schedule Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_share_this_details',
'label' => __( 'Hide Event Share this Section from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to Event Share this Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
),
array(
'name' => 'mep_event_hide_google_map_details',
'label' => __( 'Hide Event Google map from Details page ?', 'mage-eventpress' ),
'desc' => __( 'Select yes to Event google map Section from details.', 'mage-eventpress' ),
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => 'Yes',
'no' => 'No'
)
)
),
'email_setting_sec' => array(

View File

@ -993,41 +993,141 @@ $opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
function mep_event_date_meta_box_cb($post){
$values = get_post_custom( $post->ID );
$more_date = get_post_meta($post->ID, 'mep_event_more_date', true);
// print_r($values);
$values = get_post_custom( $post->ID );
// $more_date = get_post_meta($post->ID, 'mep_event_more_date', true);
// print_r($more_date);
?>
<script type="text/javascript">
jQuery(document).ready(function( $ ){
$( '#add-new-date-row' ).on('click', function() {
var row = $( '.empty-row-d.screen-reader-text' ).clone(true);
row.removeClass( 'empty-row-d screen-reader-text' );
row.insertBefore( '#repeatable-fieldset-one-d tbody>tr:last' );
return false;
});
$( '.remove-row-d' ).on('click', function() {
$(this).parents('tr').remove();
return false;
});
});
</script>
<!-- <div class='sec'>
<table width='100%'>
<tr>
<td>
<label for="event_start_date"> <?php _e('Start Date & Time:','mage-eventpress'); ?> </label>
<span><input class='event_start' id='event_start_date' type="text" name='mep_event_start_date' placeholder="YYYY-MM-DD" value='<?php if(array_key_exists('mep_event_start_date', $values)){ echo $values['mep_event_start_date'][0]; } ?>'> </span>
</td>
<td>
<label for="event_end_date"> <?php _e('End Date & Time:','mage-eventpress'); ?> </label>
<span><input class='event_end' id='event_end_date' type="text" name='mep_event_end_date' placeholder="YYYY-MM-DD" value='<?php if(array_key_exists('mep_event_end_date', $values)){ echo $values['mep_event_end_date'][0]; } ?>'> </span>
</td>
</tr>
</table>
</div> -->
<div class="sec">
<table id="repeatable-fieldset-one-d" width="100%">
<thead>
<th>Start Date</th>
<th>Start Time</th>
<th>End Date</th>
<th>End Time</th>
<th>Remove</th>
</thead>
<tbody>
<tr>
<td>
<input type="date" class="widefat" name="event_start_date" placeholder="Start Date" value="<?php if(array_key_exists('event_start_date', $values)){ echo $values['event_start_date'][0]; } ?>" />
</td>
<td>
<input type="time" class="widefat" name="event_start_time" placeholder="Start Time" value="<?php if(array_key_exists('event_start_time', $values)){ echo $values['event_start_time'][0]; } ?>" />
</td>
<td>
<input type="date" class="widefat" name="event_end_date" placeholder="End Date" value="<?php if(array_key_exists('event_end_date', $values)){ echo $values['event_end_date'][0]; } ?>" />
</td>
<td>
<input type="time" class="widefat" name="event_end_time" placeholder="End Time" value="<?php if(array_key_exists('event_end_time', $values)){ echo date('H:i',strtotime($values['event_end_time'][0])); } ?>" />
</td>
<td>
</td>
</tr>
<?php
$mep_event_multi_date = get_post_meta($post->ID,'mep_event_more_date',true);
if ( $mep_event_multi_date ) :
?>
<?php
foreach ( $mep_event_multi_date as $field ) {
?>
<tr>
<td>
<input type="date" class="widefat" name="event_more_start_date[]" placeholder="Start Date" value="<?php if($field['event_more_start_date'] != '') echo date('Y-m-d',strtotime($field['event_more_start_date']) ); ?>" />
</td>
<td>
<input type="time" class="widefat" name="event_more_start_time[]" placeholder="Start Time" value="<?php if($field['event_more_start_time'] != '') echo date('H:i',strtotime($field['event_more_start_time']) ); ?>" />
</td>
<td>
<input type="date" class="widefat" name="event_more_end_date[]" placeholder="End Date" value="<?php if($field['event_more_end_date'] != '') echo date('Y-m-d',strtotime($field['event_more_end_date']) ); ?>" />
</td>
<td>
<input type="time" class="widefat" name="event_more_end_time[]" placeholder="End Time" value="<?php if($field['event_more_end_time'] != '') echo date('H:i',strtotime($field['event_more_end_time']) ); ?>" />
</td>
<td>
<button class="button remove-row-d"><span class="dashicons dashicons-trash" style="margin-top: 3px;color: red;"></span><?php _e('Remove','mage-eventpress'); ?></button>
</td>
</tr>
<?php
}
else :
endif;
?>
<tr class="empty-row-d screen-reader-text">
<td>
<input type="date" class="widefat" name="event_more_start_date[]" placeholder="Start Date" value="" />
</td>
<td>
<input type="time" class="widefat" name="event_more_start_time[]" placeholder="Start Time" value="" />
</td>
<td>
<input type="date" class="widefat" name="event_more_end_date[]" placeholder="End Date" value="" />
</td>
<td>
<input type="time" class="widefat" name="event_more_end_time[]" placeholder="End Time" value="" />
</td>
<td>
<button class="button remove-row-d"><span class="dashicons dashicons-trash" style="margin-top: 3px;color: red;"></span><?php _e('Remove','mage-eventpress'); ?></button>
</td>
</tr>
</tbody>
</table>
<button id="add-new-date-row" class="button" style="background:green; color:white;"><span class="dashicons dashicons-plus-alt" style="margin-top: 3px;color: white;"></span><?php _e('Add More Date','mage-eventpress'); ?></button>
</div>
<?php
do_action('mep_after_date_section',$post->ID);
}
<div class='sec'>
<label for="event_start_date"> <?php _e('Start Date & Time:','mage-eventpress'); ?> </label>
<span><input class='event_start' id='event_start_date' type="text" name='mep_event_start_date' placeholder="YYYY-MM-DD" value='<?php if(array_key_exists('mep_event_start_date', $values)){ echo $values['mep_event_start_date'][0]; } ?>'> </span>
</div>
<div class="sec">
<table width="100%" class="mama">
<tr >
<td><input placeholder="Day 2 (Use this only if you have same event multiple day)" type="text" class='event_more_date' name="event_more_date[]" value="<?php if(array_key_exists('mep_event_more_date', $values)){ if(!empty($more_date[0]['event_more_date'])){ echo $more_date[0]['event_more_date']; } } ?>" /></td>
</tr>
<tr >
<td><input placeholder="Day 3(Use this only if you have same event multiple day)" type="text" class='event_more_date' name="event_more_date[]" value="<?php if(array_key_exists('mep_event_more_date', $values)){ if(!empty($more_date[1]['event_more_date'])){ echo $more_date[1]['event_more_date']; } } ?>" /></td>
</tr>
<tr >
<td><input placeholder="Day 4(Use this only if you have same event multiple day)" type="text" class='event_more_date' name="event_more_date[]" value="<?php if(array_key_exists('mep_event_more_date', $values)){ if(!empty($more_date[2]['event_more_date'])){ echo $more_date[2]['event_more_date']; } } ?>" /></td>
</tr>
</table>
</div>
<div class='sec'>
<label for="event_end_date"> <?php _e('End Date & Time:','mage-eventpress'); ?> </label>
<span><input class='event_end' id='event_end_date' type="text" name='mep_event_end_date' placeholder="YYYY-MM-DD" value='<?php if(array_key_exists('mep_event_end_date', $values)){ echo $values['mep_event_end_date'][0]; } ?>'> </span>
</div>
<?php
}
@ -1260,20 +1360,30 @@ if($post){
if (get_post_type($post_id) == 'mep_events') {
$oldm = get_post_meta($post_id, 'mep_event_more_date', true);
$mdate = array();
// $options = hhs_get_sample_options();
$oldm = get_post_meta($post_id, 'mep_event_more_date', true);
$more_start_date = isset($_POST['event_more_start_date']) ? $_POST['event_more_start_date'] : array();
$more_start_time = isset($_POST['event_more_start_time']) ? $_POST['event_more_start_time'] : '';
$more_end_date = isset($_POST['event_more_end_date']) ? $_POST['event_more_end_date'] : '';
$more_end_time = isset($_POST['event_more_end_time']) ? $_POST['event_more_end_time'] : '';
$mcount = count( $more_start_date );
for ( $m = 0; $m < $mcount; $m++ ) {
if ( $more_start_date[$m] != '' ) :
$mdate[$m]['event_more_start_date'] = stripslashes( strip_tags( $more_start_date[$m] ) );
$mdate[$m]['event_more_start_time'] = stripslashes( strip_tags( $more_start_time[$m] ) );
$mdate[$m]['event_more_end_date'] = stripslashes( strip_tags( $more_end_date[$m] ) );
$mdate[$m]['event_more_end_time'] = stripslashes( strip_tags( $more_end_time[$m] ) );
endif;
}
if(isset($_POST['event_more_date'])){$more_date = $_POST['event_more_date'];}else{$more_date=array();}
$mcount = count( $more_date );
for ( $m = 0; $m < $mcount; $m++ ) {
if ( $more_date[$m] != '' ) :
$mdate[$m]['event_more_date'] = stripslashes( strip_tags( $more_date[$m] ) );
endif;
}
if ( !empty( $mdate ) && $mdate != $oldm )
update_post_meta( $post_id, 'mep_event_more_date', $mdate );
elseif ( empty($mdate) && $oldm )
delete_post_meta( $post_id, 'mep_event_more_date', $oldm );
@ -1284,15 +1394,10 @@ elseif ( empty($mdate) && $oldm )
//if you get here then it's your post type so do your thing....
if(isset($_POST['mep_total_seat'])){
if(isset($_POST['mep_total_seat'])){
$seat = isset( $_POST['mep_total_seat'] ) ? strip_tags( $_POST['mep_total_seat'] ) : "";
$seat = isset( $_POST['mep_total_seat'] ) ? strip_tags( $_POST['mep_total_seat'] ) : "";
$rsvs = isset( $_POST['mep_rsv_seat'] ) ? strip_tags( $_POST['mep_rsv_seat'] ) : "";
$mep_location_venue = isset( $_POST['mep_location_venue'] ) ? strip_tags( $_POST['mep_location_venue'] ) : "";
$mep_street = isset( $_POST['mep_street'] ) ? strip_tags( $_POST['mep_street'] ) : "";
@ -1307,9 +1412,12 @@ $mep_sgm = isset($_POST['mep_sgm']) ? strip_tags( $_POST['mep_sgm'] )
$mep_org_address = isset($_POST['mep_org_address']) ? strip_tags( $_POST['mep_org_address'] ) : "";
$_price = isset($_POST['_price']) ? strip_tags( $_POST['_price'] ) : "";
$mep_event_start_date = strip_tags($_POST['mep_event_start_date']);
$mep_event_end_date = strip_tags($_POST['mep_event_end_date']);
$mep_event_cc_email_text = strip_tags($_POST['mep_event_cc_email_text']);
$event_start_date = strip_tags($_POST['event_start_date']);
$event_start_time = strip_tags($_POST['event_start_time']);
$event_end_date = strip_tags($_POST['event_end_date']);
$event_end_time = strip_tags($_POST['event_end_time']);
// $mep_event_end_date = strip_tags($_POST['mep_event_end_date']);
$mep_event_cc_email_text = strip_tags($_POST['mep_event_cc_email_text']);
$latitude = isset($_POST['latitude']) ? strip_tags($_POST['latitude']) : "";
@ -1348,11 +1456,14 @@ $update_mep_org_address = update_post_meta( $pid, 'mep_org_address', $mep
update_post_meta( $pid, 'event_start_date', $event_start_date);
update_post_meta( $pid, 'event_start_time', $event_start_time);
update_post_meta( $pid, 'event_end_date', $event_end_date);
update_post_meta( $pid, 'event_end_time', $event_end_time);
$mep_event_ticket_type = get_post_meta($pid, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$st_msg = 'no';
$seat = "";
@ -1396,9 +1507,9 @@ $sts_msg = update_post_meta( $pid, '_stock_msg', 'new');
$update_mep_sgm = update_post_meta( $pid, 'mep_sgm', $mep_sgm);
$update_price_label = update_post_meta( $pid, 'mep_price_label', $mep_price_label);
$update_price = update_post_meta( $pid, '_price', $_price);
$update_start = update_post_meta( $pid, 'mep_event_start_date', $mep_event_start_date);
// $update_start = update_post_meta( $pid, 'mep_event_start_date', $mep_event_start_date);
$update_virtual = update_post_meta( $pid, '_virtual', 'yes');
$update_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
// $update_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
$mep_event_cc_email_text = update_post_meta( $pid, 'mep_event_cc_email_text', $mep_event_cc_email_text);
$mep_event_sku = update_post_meta( $pid, '_sku', $pid);
}

View File

@ -1,5 +1,8 @@
<?php
function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id, $variation_id ){
$product_id = get_post_meta($product_id,'link_mep_event',true) ? get_post_meta($product_id,'link_mep_event',true) : $product_id;
if (get_post_type($product_id) == 'mep_events') {
$tp = get_post_meta($product_id,'_price',true);
@ -13,11 +16,15 @@ function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id,
$event_cart_date = $_POST['mep_event_date_cart'];
}else{ $event_cart_date = ""; }
if(isset($_POST['mep_event_start_date'])){
$mep_event_start_date = $_POST['mep_event_start_date'];
}else{ $mep_event_start_date = ""; }
if(isset($_POST['event_addt_price'])){
$checked = $_POST['event_addt_price'];
}else{ $checked=""; }
if(isset($_POST['option_name'])){
if(isset($_POST['option_name'])){
$names = $_POST['option_name'];
}else{ $names=array(); }
@ -69,9 +76,10 @@ if(isset($_POST['mep_event_ticket_type'])){
}
$mep_event_ticket_type = get_post_meta($product_id, 'mep_event_ticket_type', true);
$mep_event_ticket_type = get_post_meta($product_id, 'mep_event_ticket_type', true) ? get_post_meta($product_id, 'mep_event_ticket_type', true) : array();
$cnt = 0;
$ticket_type_arr = array();
if(is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 0){
foreach($mep_event_ticket_type as $_type){
// echo $_type['option_name_t'];
$cart_arr = $new[$cnt];
@ -86,16 +94,16 @@ if(isset($_POST['mep_event_ticket_type'])){
if($cart_arr['option_qty'] > 0){
$ticket_type_arr[$cnt]['ticket_name'] = stripslashes( strip_tags( $cart_arr[$name_key] ) );
$ticket_type_arr[$cnt]['ticket_qty'] = stripslashes( strip_tags( $cart_arr['option_qty'] ) );
$ticket_type_arr[$cnt]['ticket_price'] = stripslashes( strip_tags( $cart_arr['option_price'] ) );
$ticket_type_arr[$cnt]['event_date'] = stripslashes( strip_tags( $mep_event_start_date ) );
}
$cnt++;
}
}
$mep_events_extra_prices = get_post_meta($product_id, 'mep_events_extra_prices', true);
$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){
@ -104,7 +112,6 @@ foreach($mep_events_extra_prices as $extra_service){
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']));
}
@ -117,6 +124,7 @@ foreach($mep_events_extra_prices as $extra_service){
}
$cart_item_data['event_ticket_info'] = $ticket_type_arr;
$cart_item_data['event_extra_option'] = $new;
$cart_item_data['event_user_info'] = $user;
@ -125,20 +133,21 @@ foreach($mep_events_extra_prices as $extra_service){
$cart_item_data['line_subtotal'] = $tp;
$cart_item_data['event_cart_location'] = $event_cart_location;
$cart_item_data['event_cart_date'] = $event_cart_date;
$cart_item_data['event_cart_date'] = $mep_event_start_date;
// $cart_item_data['event_cart_date'] = $event_cart_date;
}
$cart_item_data['event_id'] = $product_id;
return $cart_item_data;
}
add_filter( 'woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_cart_item', 10, 3);
add_filter( 'woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_cart_item', 90, 3);
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price',90,1 );
function add_custom_price( $cart_object ) {
foreach ( $cart_object->cart_contents as $key => $value ) {
foreach ( $cart_object->cart_contents as $key => $value ) {
$eid = $value['event_id'];
if (get_post_type($eid) == 'mep_events') {
$cp = $value['event_tp'];
@ -147,12 +156,6 @@ if (get_post_type($eid) == 'mep_events') {
$value['data']->set_sale_price($cp);
$value['data']->set_sold_individually('yes');
$new_price = $value['data']->get_price();
// echo $value['data']->get_regular_price();
// echo '<pre>';
// print_r(wc_get_product(4045));
// echo '</pre>';
// die();
// update_post_meta($eid,'_price',$cp);
}
}
}
@ -165,34 +168,46 @@ function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
$mep_events_extra_prices = $cart_item['event_extra_option'];
// print_r($cart_item);
$eid = $cart_item['event_id'];
if (get_post_type($eid) == 'mep_events') {
// print_r($cart_item['event_ticket_info']);
if (get_post_type($eid) == 'mep_events') {
$user_info = $cart_item['event_user_info'];
$ticket_type_arr = $cart_item['event_ticket_info'];
// echo '<pre>';
// print_r($user_info);
echo "<ul class='event-custom-price'>";
if(is_array($user_info) && sizeof($user_info > 0)){
foreach($user_info as $userinf){
?>
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo date('D, d M Y',strtotime($userinf['user_event_date'])); ?></li>
<?php
}
}else{
?>
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo date('D, d M Y',strtotime($cart_item['event_cart_date'])); ?></li>
<?php
}
?>
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_date']; ?></li>
<li><?php _e('Event Location','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; //echo $cart_item['event_ticket_type']; ?></li>
<?php
if($mep_events_extra_prices){
foreach ( $mep_events_extra_prices as $field ) {
if($field['option_qty']>0){
?>
<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($field['option_qty']>0){
?>
<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']){
echo "<li> Ticket: ".$cart_item['event_ticket_type']." x ".$cart_item['event_ticket_qty'].": ".wc_price($cart_item['event_ticket_price'])."</li>";
}
echo "</ul>";
}
return $item_data;
echo "</ul>";
}
add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', 10, 2 );
return $item_data;
}
add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', 90, 2 );
@ -200,25 +215,25 @@ add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart',
function mep_add_custom_fields_text_to_order_items( $item, $cart_item_key, $values, $order ) {
$eid = $values['event_id'];
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'])){
$event_ticket_type = $values['event_ticket_type'];
$event_ticket_type = $values['event_ticket_type'];
}else{
$event_ticket_type = " ";
$event_ticket_type = " ";
}
if(isset($values['event_ticket_price'])){
$event_ticket_price = $values['event_ticket_price'];
$event_ticket_price = $values['event_ticket_price'];
}else{
$event_ticket_price = " ";
$event_ticket_price = " ";
}
if(isset($values['event_ticket_qty'])){
$event_ticket_qty = $values['event_ticket_qty'];
$event_ticket_qty = $values['event_ticket_qty'];
}else{
$event_ticket_qty = " ";
$event_ticket_qty = " ";
}
$product_id = $values['product_id'];
$cart_location = $values['event_cart_location'];
$cart_date = $values['event_cart_date'];
$product_id = $values['product_id'];
$cart_location = $values['event_cart_location'];
$cart_date = $values['event_cart_date'];
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
if($form_position=='details_page'){
@ -230,56 +245,39 @@ $form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec
$item->add_meta_data('Date',$cart_date);
$item->add_meta_data('Location',$cart_location);
$item->add_meta_data('_event_ticket_info',$values['event_ticket_info']);
$item->add_meta_data('Location',$cart_location);
$item->add_meta_data('_event_ticket_info',$values['event_ticket_info']);
if (is_array($mep_events_extra_prices) || is_object($mep_events_extra_prices)){
foreach ( $mep_events_extra_prices as $field ) {
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'] ) );
$opt_name = $product_id.str_replace(' ', '', $field['option_name']);
$opt_qty = $field['option_qty'];
// $tes = 0;
$tes = get_post_meta($product_id,"mep_xtra_$opt_name",true);
$ntes = ($tes+$opt_qty);
update_post_meta( $product_id, "mep_xtra_$opt_name",$ntes);
foreach ( $mep_events_extra_prices as $field ) {
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'] ) );
// $opt_name = $product_id.str_replace(' ', '', $field['option_name']);
// $opt_qty = $field['option_qty'];
// $tes = get_post_meta($product_id,"mep_xtra_$opt_name",true);
// $ntes = ($tes+$opt_qty);
// update_post_meta( $product_id, "mep_xtra_$opt_name",$ntes);
}
}
}
}
if($event_ticket_type){
// $event_ticket_type = "Ticket:".$event_ticket_type;
// $item->add_meta_data( $event_ticket_type." x ".$event_ticket_qty,get_woocommerce_currency_symbol().$event_ticket_price);
$tck_name = $product_id.str_replace(' ', '', $event_ticket_type);
$tesqt = get_post_meta($product_id,"mep_xtra_$tck_name",true);
$ntesqt = ($tesqt+$event_ticket_qty);
update_post_meta( $product_id, "mep_xtra_$tck_name",$ntesqt);
$item->add_meta_data('_event_ticket_type','ticket_typs');
}else{
$item->add_meta_data('_event_ticket_type','normal');
// $tck_name = $product_id.str_replace(' ', '', $event_ticket_type);
// $tesqt = get_post_meta($product_id,"mep_xtra_$tck_name",true);
// $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_user_info',$event_user_info);
$item->add_meta_data('_no_of_ticket',count($event_user_info));
$item->add_meta_data('_event_service_info',$mep_events_extra_prices);
$item->add_meta_data('event_id',$eid);
$item->add_meta_data('_product_id',$eid);
}
$item->add_meta_data('_event_user_info',$event_user_info);
$item->add_meta_data('_no_of_ticket',count($event_user_info));
$item->add_meta_data('_event_service_info',$mep_events_extra_prices);
$item->add_meta_data('event_id',$eid);
$item->add_meta_data('_product_id',$eid);
}
// update_post_meta($eid,'_price',0);
}
add_action( 'woocommerce_checkout_create_order_line_item', 'mep_add_custom_fields_text_to_order_items', 10, 4 );
add_action( 'woocommerce_checkout_create_order_line_item', 'mep_add_custom_fields_text_to_order_items', 90, 4 );

View File

@ -30,7 +30,7 @@ const myEvents = [
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'mep_event_start_date',
'key' => 'event_start_date',
'value' => $now,
'compare' => '>'
)
@ -46,15 +46,15 @@ const myEvents = [
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date_i18n('Y-m-d H:i:s',$time);
// echo $newformat;
// if(time() < strtotime($newformat)){
?>
{
start: '<?php echo date_i18n('Y-m-d H:i',strtotime($event_meta['mep_event_start_date'][0])); ?>',
end: '<?php echo date_i18n('Y-m-d H:i',strtotime($event_meta['mep_event_end_date'][0])); ?>',
start: '<?php echo date_i18n('Y-m-d H:i',strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0])); ?>',
end: '<?php echo date_i18n('Y-m-d H:i',strtotime($event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0])); ?>',
title: '<?php the_title(); ?>',
url: '<?php the_permalink(); ?>',
class: '',
@ -83,6 +83,7 @@ function mep_event_list($atts, $content=null){
"cat" => "0",
"org" => "0",
"style" => "grid",
"column" => 2,
"cat-filter" => "no",
"org-filter" => "no",
"show" => "-1",
@ -99,7 +100,8 @@ function mep_event_list($atts, $content=null){
$show = $params['show'];
$pagination = $params['pagination'];
$sort = $params['sort'];
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'mep_event_start_date');
$column = $params['column'];
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date');
ob_start();
?>
<div class='mep_event_list'>
@ -142,9 +144,11 @@ foreach ($terms as $_terms) {
<div class="mep_event_list_sec">
<?php
$now = current_time('Y-m-d H:i:s');
$show_price = mep_get_option( 'mep_event_price_show', 'general_setting_sec', 'yes');
$show_price_label = mep_get_option( 'event-price-label', 'general_setting_sec', 'Price Starts from:');
$paged = get_query_var("paged")?get_query_var("paged"):1;
if($cat>0){
$args_search_qqq = array (
'post_type' => array( 'mep_events' ),
@ -152,7 +156,7 @@ if($cat>0){
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -177,7 +181,7 @@ elseif($org>0){
'paged' => $paged,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -202,7 +206,7 @@ elseif($org>0){
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -219,7 +223,7 @@ elseif($org>0){
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date_i18n('Y-m-d H:i:s',$time);
$tt = get_the_terms( get_the_id(), 'mep_cat');
@ -231,20 +235,29 @@ $cat_class = mep_get_term_as_class(get_the_id(),'mep_cat');
$available_seat = mep_get_total_available_seat(get_the_id(), $event_meta);
if ($column == 2){
$columnNumber = 'two_column';
} elseif ($column == 3){
$columnNumber = 'three_column';
}elseif($column == 4){
$columnNumber = 'four_column';
}else{
$columnNumber = 'two_column';
}
?>
<div class='mep_event_<?php echo $style; ?>_item mix <?php if($tt){ echo 'mage-'.$org_class; } ?> <?php if($torg){ echo 'mage-'.$cat_class; } ?>'>
<div class='<?php echo $columnNumber; ?> mep_event_<?php echo $style; ?>_item mix <?php if($tt){ echo 'mage-'.$org_class; } ?> <?php if($torg){ echo 'mage-'.$cat_class; } ?>'>
<div class="mep_list_thumb">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('full'); ?></a>
<div class="mep-ev-start-date">
<div class="mep-day"><?php echo date_i18n('d', strtotime($event_meta['mep_event_start_date'][0])); ?></div>
<div class="mep-month"><?php echo date_i18n('M', strtotime($event_meta['mep_event_start_date'][0])); ?></div>
<div class="mep-day"><?php echo date_i18n('d', strtotime($event_meta['event_start_date'][0])); ?></div>
<div class="mep-month"><?php echo date_i18n('M', strtotime($event_meta['event_start_date'][0])); ?></div>
</div>
</div>
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
<div class="mep-list-header">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<?php if($available_seat==0){ do_action('mep_show_waitlist_label'); } ?>
<h3 class='mep_list_date'> <?php if($show_price=='yes'){ echo $show_price_label." ".mep_event_list_price(get_the_id()); }?><!-- <i class="fa fa-calendar"></i> <?php echo date_i18n('h:i A', strtotime($event_meta['mep_event_start_date'][0])); ?> - <?php echo $event_meta['mep_event_end_date'][0]; ?> --></h3>
<h3 class='mep_list_date'> <?php if($show_price=='yes'){ echo $show_price_label." ".mep_event_list_price(get_the_id()); }?><!-- <i class="fa fa-calendar"></i> <?php echo date_i18n('h:i A', strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0])); ?> - <?php echo $event_meta['event_end_time'][0]; ?> --></h3>
</div>
<?php
@ -282,7 +295,7 @@ if($style=='list'){
<h5>
<?php echo mep_get_option('mep_time_text', 'label_setting_sec') ? mep_get_option('mep_time_text', 'label_setting_sec') : _e('Time:','mage-eventpress'); ?>
</h5>
<h6><?php mep_get_only_time($event_meta['mep_event_start_date'][0]); ?> - <?php mep_get_only_time($event_meta['mep_event_end_date'][0]); ?></h6>
<h6><?php mep_get_only_time($event_meta['event_start_time'][0]); ?> - <?php mep_get_only_time($event_meta['event_end_time'][0]); ?></h6>
</div>
</li>
</ul>
@ -352,7 +365,7 @@ function mep_expire_event_list($atts, $content=null){
$show = $params['show'];
$pagination = $params['pagination'];
$sort = $params['sort'];
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'mep_event_start_date');
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date');
ob_start();
?>
<div class='mep_event_list'>
@ -406,7 +419,7 @@ if($cat>0){
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -431,7 +444,7 @@ elseif($org>0){
'paged' => $paged,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -456,7 +469,7 @@ elseif($org>0){
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'mep_event_start_date',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
@ -473,7 +486,7 @@ elseif($org>0){
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date_i18n('Y-m-d H:i:s',$time);
@ -488,14 +501,14 @@ $author_terms = get_the_terms(get_the_id(), 'mep_org');
<div class="mep_list_thumb">
<?php the_post_thumbnail('full'); ?>
<div class="mep-ev-start-date">
<div class="mep-day"><?php echo date_i18n('d', strtotime($event_meta['mep_event_start_date'][0])); ?></div>
<div class="mep-month"><?php echo date_i18n('M', strtotime($event_meta['mep_event_start_date'][0])); ?></div>
<div class="mep-day"><?php echo date_i18n('d', strtotime($event_meta['event_start_date'][0])); ?></div>
<div class="mep-month"><?php echo date_i18n('M', strtotime($event_meta['event_start_date'][0])); ?></div>
</div>
</div>
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
<div class="mep-list-header">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<h3 class='mep_list_date'> Price Start from: <?php echo mep_event_list_price(get_the_id()); ?><!-- <i class="fa fa-calendar"></i> <?php echo date_i18n('h:i A', strtotime($event_meta['mep_event_start_date'][0])); ?> - <?php echo $event_meta['mep_event_end_date'][0]; ?> --></h3>
<h3 class='mep_list_date'> Price Start from: <?php echo mep_event_list_price(get_the_id()); ?><!-- <i class="fa fa-calendar"></i> <?php echo date_i18n('h:i A', strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0])); ?> - <?php echo $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0]; ?> --></h3>
</div>
<?php
@ -534,7 +547,7 @@ if($style=='list'){
<?php echo mep_get_option('mep_time_text', 'label_setting_sec') ? mep_get_option('mep_time_text', 'label_setting_sec') : _e('Time:','mage-eventpress'); ?>
</h5>
<h6><?php mep_get_only_time($event_meta['mep_event_start_date'][0]); ?> - <?php mep_get_only_time($event_meta['mep_event_end_date'][0]); ?></h6>
<h6><?php mep_get_only_time($event_meta['event_start_time'][0]); ?> - <?php mep_get_only_time($event_meta['event_end_time'][0]); ?></h6>
</div>
</li>
</ul>
@ -570,3 +583,257 @@ if($pagination=='yes'){
$content = ob_get_clean();
return $content;
}
add_shortcode( 'event-list-onepage', 'mep_event_onepage_list' );
function mep_event_onepage_list($atts, $content=null){
$defaults = array(
"cat" => "0",
"org" => "0",
"style" => "grid",
"cat-filter" => "no",
"org-filter" => "no",
"show" => "-1",
"pagination" => "no",
'sort' => 'ASC'
);
$params = shortcode_atts($defaults, $atts);
$cat = $params['cat'];
$org = $params['org'];
$style = $params['style'];
$cat_f = $params['cat-filter'];
$org_f = $params['org-filter'];
$show = $params['show'];
$pagination = $params['pagination'];
$sort = $params['sort'];
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date');
ob_start();
do_action( 'woocommerce_before_single_product' );
?>
<div class='mep_event_list'>
<?php if($cat_f=='yes'){ ?>
<div class="mep-events-cats-list">
<?php
$terms = get_terms( array(
'taxonomy' => 'mep_cat'
) );
?>
<div class="mep-event-cat-controls">
<button type="button" class="mep-cat-control" data-filter="all"><?php _e('All','mage-eventpress'); ?></button><?php
foreach ($terms as $_terms) {
?><button type="button" class="mep-cat-control" data-filter=".<?php echo 'mage-'.$_terms->slug; ?>"><?php echo $_terms->name; ?></button><?php
}
?>
</div>
</div>
<?php } if($org_f=='yes'){ ?>
<div class="mep-events-cats-list">
<?php
$terms = get_terms( array(
'taxonomy' => 'mep_org'
) );
?>
<div class="mep-event-cat-controls">
<button type="button" class="mep-cat-control" data-filter="all"><?php _e('All','mage-eventpress'); ?></button><?php
foreach ($terms as $_terms) {
?><button type="button" class="mep-cat-control" data-filter=".<?php echo 'mage-'.$_terms->slug; ?>"><?php echo $_terms->name; ?></button><?php
}
?>
</div>
</div>
<?php } ?>
<div class="mep_event_list_sec">
<?php
$now = current_time('Y-m-d H:i:s');
$show_price = mep_get_option( 'mep_event_price_show', 'general_setting_sec', 'yes');
$show_price_label = mep_get_option( 'event-price-label', 'general_setting_sec', 'Price Starts from:');
$paged = get_query_var("paged")?get_query_var("paged"):1;
if($cat>0){
$args_search_qqq = array (
'post_type' => array( 'mep_events' ),
'paged' => $paged,
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
'value' => $now,
'compare' => '>'
)
),
'tax_query' => array(
array(
'taxonomy' => 'mep_cat',
'field' => 'term_id',
'terms' => $cat
)
)
);
}
elseif($org>0){
$args_search_qqq = array (
'post_type' => array( 'mep_events' ),
'posts_per_page' => $show,
'paged' => $paged,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
'value' => $now,
'compare' => '>'
)
),
'tax_query' => array(
array(
'taxonomy' => 'mep_org',
'field' => 'term_id',
'terms' => $org
)
)
);
}
else{
$args_search_qqq = array (
'post_type' => array( 'mep_events' ),
'paged' => $paged,
'posts_per_page' => $show,
'order' => $sort,
'orderby' => 'meta_value',
'meta_key' => 'event_start_date',
'meta_query' => array(
array(
'key' => $event_expire_on,
'value' => $now,
'compare' => '>'
)
)
);
}
$loop = new WP_Query( $args_search_qqq );
while ($loop->have_posts()) {
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$author_terms = get_the_terms(get_the_id(), 'mep_org');
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$time = strtotime($start_datetime);
$newformat = date_i18n('Y-m-d H:i:s',$time);
$tt = get_the_terms( get_the_id(), 'mep_cat');
$torg = get_the_terms( get_the_id(), 'mep_org');
$org_class = mep_get_term_as_class(get_the_id(),'mep_org');
$cat_class = mep_get_term_as_class(get_the_id(),'mep_cat');
$available_seat = mep_get_total_available_seat(get_the_id(), $event_meta);
?>
<div class='mep_event_<?php echo $style; ?>_item mix <?php if($tt){ echo 'mage-'.$org_class; } ?> <?php if($torg){ echo 'mage-'.$cat_class; } ?>'>
<div class="mep_list_thumb">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('full'); ?></a>
<div class="mep-ev-start-date">
<div class="mep-day"><?php echo date_i18n('d', strtotime($event_meta['event_start_date'][0])); ?></div>
<div class="mep-month"><?php echo date_i18n('M', strtotime($event_meta['event_start_date'][0])); ?></div>
</div>
</div>
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
<div class="mep-list-header">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<?php if($available_seat==0){ do_action('mep_show_waitlist_label'); } ?>
<h3 class='mep_list_date'> <?php if($show_price=='yes'){ echo $show_price_label." ".mep_event_list_price(get_the_id()); }?><!-- <i class="fa fa-calendar"></i> <?php echo date_i18n('h:i A', strtotime($event_meta['event_start_time'][0])); ?> - <?php echo $event_meta['event_end_date'][0]; ?> --></h3>
</div>
<div class="mep-list-footer">
<ul>
<li>
<div class="evl-ico"><i class="fa fa-university"></i> </div>
<div class="evl-cc">
<h5>
<?php echo mep_get_option('mep_organized_by_text', 'label_setting_sec') ? mep_get_option('mep_organized_by_text', 'label_setting_sec') : _e('Organized By:','mage-eventpress'); ?>
</h5>
<h6><?php if($author_terms){ echo $author_terms[0]->name; } ?></h6>
</div>
</li>
<li>
<div class="evl-ico"><i class="fa fa-location-arrow"></i> </div>
<div class="evl-cc">
<h5>
<?php echo mep_get_option('mep_location_text', 'label_setting_sec') ? mep_get_option('mep_location_text', 'label_setting_sec') : _e('Location:','mage-eventpress'); ?>
</h5>
<h6><?php mep_get_event_city(get_the_id()); ?></h6>
</div>
</li>
<li>
<div class="evl-ico"><i class="fa fa-calendar"></i> </div>
<div class="evl-cc">
<h5>
<?php echo mep_get_option('mep_time_text', 'label_setting_sec') ? mep_get_option('mep_time_text', 'label_setting_sec') : _e('Time:','mage-eventpress'); ?>
</h5>
<h6><?php mep_get_only_time($event_meta['event_start_time'][0]); ?> - <?php mep_get_only_time($event_meta['event_end_time'][0]); ?></h6>
</div>
</li>
</ul>
</div></a>
<?php
$currency_pos = get_option( 'woocommerce_currency_pos' );
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
echo '<div class=event-cart-section-list>';
do_action( 'mep_add_to_cart_list' );
echo '</div>';
?>
</div>
</div>
<?php
get_event_list_js(get_the_id(),$event_meta,$currency_pos);
}
wp_reset_postdata();
//}
if($pagination=='yes'){
?>
<div class="row">
<div class="col-md-12"><?php
$pargs = array(
"current"=>$paged,
"total"=>$loop->max_num_pages
);
echo "<div class='pagination-sec'>".paginate_links($pargs)."</div>";
?>
</div>
</div>
<?php }
?>
</div>
</div>
<?php
$content = ob_get_clean();
return $content;
}

View File

@ -2,46 +2,41 @@
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',
'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' => '='
)
)
'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;
}
@ -52,6 +47,93 @@ 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_default_date_update_20' ) != 'completed' ) {
$args = array(
'post_type' => 'mep_events',
'posts_per_page' => -1
);
$qr = new WP_Query($args);
foreach($qr->posts as $result){
$post_id = $result->ID;
$mep_start_date = get_post_meta($post_id, 'mep_event_start_date', true);
$mep_end_date = get_post_meta($post_id, 'mep_event_end_date', true);
$event_start_date = date('Y-m-d',strtotime($mep_start_date));
$event_start_time = date('H:i',strtotime($mep_start_date));
$event_end_date = date('Y-m-d',strtotime($mep_end_date));
$event_end_time = date('H:i',strtotime($mep_end_date));
update_post_meta( $post_id, 'event_start_date', $event_start_date );
update_post_meta( $post_id, 'event_start_time', $event_start_time );
update_post_meta( $post_id, 'event_end_date', $event_end_date );
update_post_meta( $post_id, 'event_end_time', $event_end_time );
}
update_option( 'mep_event_default_date_update_20', 'completed' );
}
if ( get_option( 'mep_attendee_event_date_update_20' ) != 'completed' ) {
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1
);
$qr = new WP_Query($args);
foreach($qr->posts as $result){
$post_id = $result->ID;
$ea_event_date = get_post_meta($post_id, 'ea_event_date', true);
if(empty($ea_event_date)){
$event_id = get_post_meta($post_id, 'ea_event_id', true);
$event_old_date = get_post_meta($event_id, 'event_start_date', true).' '.get_post_meta($event_id, 'event_start_time', true);
update_post_meta( $post_id, 'ea_event_date', $event_old_date );
}
}
update_option( 'mep_attendee_event_date_update_20', 'completed' );
}
if ( get_option( 'mep_event_multidate_update_2' ) != 'completed' ) {
$args = array(
'post_type' => 'mep_events',
'posts_per_page' => -1
);
$qr = new WP_Query($args);
foreach($qr->posts as $result){
$post_id = $result->ID;
$more_date = get_post_meta($post_id, 'mep_event_more_date', true);
if(is_array($more_date) && sizeof($more_date) > 0){
$count = 0;
foreach($more_date as $_multi_date){
$start_date = date('Y-m-d',strtotime($_multi_date['event_more_date']));
$start_time = date('H:i A',strtotime($_multi_date['event_more_date']));
$multi_dates[$count]['event_more_start_date'] = stripslashes( strip_tags( $start_date ) );
$multi_dates[$count]['event_more_start_time'] = stripslashes( strip_tags( $start_time ) );
$multi_dates[$count]['event_more_end_date'] = stripslashes( strip_tags( '' ) );
$multi_dates[$count]['event_more_end_time'] = stripslashes( strip_tags( '' ) );
$count++;
}
update_post_meta( $post_id, 'mep_event_more_date', $multi_dates );
}
}
update_option( 'mep_event_multidate_update_2', 'completed' );
}
if ( get_option( 'mep_event_magor_update_3' ) != 'completed' ) {
global $wpdb;
@ -76,27 +158,26 @@ foreach($orders as $order_id){
$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_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_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);
$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){
@ -150,5 +231,53 @@ update_option( 'mep_event_magor_update_3', 'completed' );
}
// die();
}
// Function for create hidden product for bus
function mep_create_hidden_event_product($post_id,$title){
$new_post = array(
'post_title' => $title,
'post_content' => '',
'post_category' => array(),
'tags_input' => array(),
'post_status' => 'publish',
'post_type' => 'product'
);
$pid = wp_insert_post($new_post);
update_post_meta( $post_id, 'link_wc_product', $pid );
update_post_meta( $pid, 'link_mep_event', $post_id );
update_post_meta( $pid, '_price', 0.01 );
update_post_meta( $pid, '_sold_individually', 'yes' );
update_post_meta( $pid, '_virtual', 'yes' );
$terms = array( 'exclude-from-catalog', 'exclude-from-search' );
wp_set_object_terms( $pid, $terms, 'product_visibility' );
update_post_meta( $post_id, 'check_if_run_once', true );
}
add_action('admin_init','mep_create_old_event_product',10);
function mep_create_old_event_product(){
if ( get_option( 'wbtm_create_old_bus_products_101' ) != 'completed' ) {
$args = array(
'post_type' => 'mep_events',
'posts_per_page' => -1
);
$qr = new WP_Query($args);
foreach($qr->posts as $result){
$post_id = $result->ID;
mep_create_hidden_event_product($post_id,get_the_title($post_id));
}
update_option( 'wbtm_create_old_bus_products_101', 'completed' );
}
}

View File

@ -417,3 +417,11 @@ A. you can create support ticket here with problem details with possible screens
==> Bug Fixed
==> Event seating issue fixed while order status chganged
04 Nov 2019*
*= 3.0.0 =
* Update Release:
==> Code Improved
==> Facebook For Woocommerce Issue Fixed
==> Bug Fixed
10 Dec 2019*

View File

@ -33,6 +33,9 @@ $currency_pos = get_option( 'woocommerce_currency_pos' );
<?php
require_once(dirname(__FILE__) . "/themes/$_current_template"); ?>
</div>
<div class="mep-related-events-sec">
<?php do_action('after-single-events'); ?>
</div>
<script>
jQuery('#quantity_5a7abbd1bff73').click(function() {
var $form = jQuery('form'); //on a real app it would be better to have a class or ID
@ -126,6 +129,34 @@ jQuery(".extra-qty-box").on('change', function() {
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$count =1;
$event_id = $post->ID;
$event_more_date[0]['event_more_start_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_start_date',true)));
$event_more_date[0]['event_more_start_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_start_time',true)));
$event_more_date[0]['event_more_end_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_end_date',true)));
$event_more_date[0]['event_more_end_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_end_time',true)));
$event_more_dates = get_post_meta($event_id,'mep_event_more_date',true);
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
if($recurring == 'yes'){
$event_multi_date = array_merge($event_more_date,$event_more_dates);
}else{
$event_multi_date = $event_more_date;
}
foreach($event_multi_date as $event_date){
$start_date = date('Y-m-d H:i',strtotime($event_date['event_more_start_date'].' '.$event_date['event_more_start_time']));
if(strtotime(current_time('Y-m-d H:i:s')) < strtotime($start_date)){
foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
?>
@ -133,6 +164,15 @@ $qm = $field['option_name_t'];
//jQuery('.btn-mep-event-cart').hide();
jQuery('.btn-mep-event-cart').attr('disabled','disabled');
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
var inputs = jQuery("#ttyttl").html() || 0;
@ -140,26 +180,24 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
var input = parseInt(inputs);
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
jQuery(document).on("change", ".etp", function() {
jQuery(document).on("change", ".etp", function() {
var TotalQty = 0;
jQuery(".etp").each(function(){
TotalQty += +jQuery(this).val();
TotalQty += +jQuery(this).val();
});
//alert(sum);
if(TotalQty == 0){
//jQuery('.btn-mep-event-cart').hide();
jQuery('.btn-mep-event-cart').attr('disabled','disabled');
jQuery('#mep_btn_notice').show();
}else{
//jQuery('.btn-mep-event-cart').show();
jQuery('.btn-mep-event-cart').removeAttr('disabled');
jQuery('#mep_btn_notice').hide();
}
if(TotalQty == 0){
//jQuery('.btn-mep-event-cart').hide();
jQuery('.btn-mep-event-cart').attr('disabled','disabled');
jQuery('#mep_btn_notice').show();
}else{
//jQuery('.btn-mep-event-cart').show();
jQuery('.btn-mep-event-cart').removeAttr('disabled');
jQuery('#mep_btn_notice').hide();
}
});
});
if(input < children){
jQuery('#dadainfo_<?php echo $count; ?>').empty();
@ -170,13 +208,24 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
jQuery('#dadainfo_<?php echo $count; ?>').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
.html("<?php do_action('mep_reg_fields'); ?>")
);
.html("<?php do_action('mep_reg_fields',$start_date); ?>")
);
}
});
<?php
$count++;
}
}
}
}else{
?>
jQuery('#mep_btn_notice').hide();
@ -191,10 +240,7 @@ jQuery('#quantity_5a7abbd1bff73').on('change', function () {
for (var i = children+1; i <= input; i++) {
jQuery('#divParent').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
.html("<?php do_action('mep_reg_fields'); ?>")
);
}
.attr("id", "newDiv" + i)event_start_date
});
<?php
}

View File

@ -27,7 +27,7 @@ $term_id = get_queried_object()->term_id;
while ($loop->have_posts()) {
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date('Y-m-d H:i:s',$time);
@ -38,7 +38,7 @@ $term_id = get_queried_object()->term_id;
<div class="mep_list_thumb"><?php the_post_thumbnail('medium'); ?></div>
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<h3 class='mep_list_date'>on <?php echo $event_meta['mep_event_start_date'][0]; ?> - <?php echo $event_meta['mep_event_end_date'][0]; ?></h3>
<h3 class='mep_list_date'>on <?php echo $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]; ?> - <?php echo $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0]; ?></h3>
<p><?php echo $event_meta['mep_location_venue'][0]; ?>,<?php echo $event_meta['mep_street'][0]; ?>, <?php echo $event_meta['mep_city'][0]; ?>,<?php echo $event_meta['mep_state'][0]; ?>,<?php echo $event_meta['mep_postcode'][0]; ?>,<?php echo $event_meta['mep_country'][0]; ?></p>
</a>

View File

@ -29,7 +29,7 @@ $term_id = get_queried_object()->term_id;
while ($loop->have_posts()) {
$loop->the_post();
$event_meta = get_post_custom(get_the_id());
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date('Y-m-d H:i:s',$time);
@ -40,7 +40,7 @@ $term_id = get_queried_object()->term_id;
<div class="mep_list_thumb"><?php the_post_thumbnail('medium'); ?></div>
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
<h2 class='mep_list_title'><?php the_title(); ?></h2>
<h3 class='mep_list_date'>on <?php echo $event_meta['mep_event_start_date'][0]; ?> - <?php echo $event_meta['mep_event_end_date'][0]; ?></h3>
<h3 class='mep_list_date'>on <?php echo $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]; ?> - <?php echo $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0]; ?></h3>
<p><?php echo $event_meta['mep_location_venue'][0]; ?>,<?php echo $event_meta['mep_street'][0]; ?>, <?php echo $event_meta['mep_city'][0]; ?>,<?php echo $event_meta['mep_state'][0]; ?>,<?php echo $event_meta['mep_postcode'][0]; ?>,<?php echo $event_meta['mep_country'][0]; ?></p>
</a>

View File

@ -5,9 +5,9 @@ add_action('mep_add_to_cart','mep_get_event_reg_btn');
function mep_get_event_reg_btn(){
global $post,$event_meta;
$post_id = $post->ID;
$event_meta = get_post_custom($post_id);
$event_expire_date = $event_meta[mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'mep_event_start_date' )][0];
$event_sqi = $event_meta['mep_sqi'][0];
$event_meta = get_post_custom($post_id);
$event_expire_date = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$event_sqi = $event_meta['mep_sqi'][0];
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
@ -62,43 +62,48 @@ if($mep_event_ticket_type){
}
$current = current_time('Y-m-d H:i:s');
$time = strtotime($event_expire_date);
$newformat = date('Y-m-d H:i:s',$time);
date_default_timezone_set(get_option('timezone_string'));
$current = current_time('Y-m-d H:i:s');
$time = strtotime($event_expire_date);
$newformat = date('Y-m-d H:i:s',$time);
$datetime1 = new DateTime($newformat);
$datetime2 = new DateTime($current);
$interval = date_diff($datetime2, $datetime1);
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
// $days = $interval->days;
// $hours = $interval->h;
// $minutes = $interval->i;
// if($days>0){ $dd = $days." days "; }else{ $dd=""; }
// if($hours>0){ $hh = $hours." hours "; }else{ $hh=""; }
// if($minutes>0){ $mm = $minutes." minutes "; }else{ $mm=""; }
// echo "<span class='active'>$dd $hh $mm</span>";
if($recurring == 'yes'){
$event_more_dates = get_post_meta($post_id,'mep_event_more_date',true);
$seat_left = 10;
$md = end($event_more_dates);
$more_date = $md['event_more_start_date'].' '.$md['event_more_start_time'];
$newformat = date('Y-m-d H:i:s',strtotime($more_date));
}
if(time() > strtotime($newformat)){
date_default_timezone_set(get_option('timezone_string'));
$datetime1 = new DateTime($newformat);
$datetime2 = new DateTime($current);
$interval = date_diff($datetime2, $datetime1);
if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_event_expired_text', 'label_setting_sec') ? mep_get_option('mep_event_expired_text', 'label_setting_sec') : _e('Event Expired','mage-eventpress'); ?>
</span>
<?php
}
elseif($seat_left<=0){
} elseif($seat_left<=0){
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
</span>
<?php
do_action('mep_after_no_seat_notice');
}
else{
}else{
if(array_key_exists('mep_rsv_seat', $event_meta)){
$simple_rsv = $event_meta['mep_rsv_seat'][0];
@ -188,7 +193,317 @@ if($event_sqi==1){
<p class="mep_no_tickt_notice" id="mep_btn_notice">
<?php echo mep_get_option('mep_no_ticket_selected_text', 'label_setting_sec') ? mep_get_option('mep_no_ticket_selected_text', 'label_setting_sec') : _e('No Ticket Selected!','mage-eventpress'); ?>
</p>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr($post_id); ?>" class="single_add_to_cart_button button alt btn-mep-event-cart"><?php _e(mep_get_label($post_id,'mep_cart_btn_text','Register This Event'),'mage-eventpress'); ?> </button>
<?php
$cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id);
?>
<button type="submit" name="add-to-cart" value="<?php echo $cart_product_id; //echo esc_attr($post_id); ?>" class="single_add_to_cart_button button alt btn-mep-event-cart"><?php _e(mep_get_label($post_id,'mep_cart_btn_text','Register This Event'),'mage-eventpress'); ?> </button>
</td>
</tr>
</table>
<?php
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if(!$mep_event_ticket_type){
if($qm){$qm=$qm;}else{$qm='';}
?><?php do_action('mep_single_page_reg'); ?><?php }
}
?>
</form><?php
}
}
}
add_action('mep_add_to_cart_list','mep_get_event_reg_btn_list');
// Get Event Registration Button
function mep_get_event_reg_btn_list(){
global $post,$event_meta;
$post_id = $post->ID;
$event_meta = get_post_custom($post_id);
$event_expire_date = $event_meta[mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date' )][0];
$event_sqi = $event_meta['mep_sqi'][0];
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
$event_ecternal_link = '';
$book_count = get_post_meta($post_id,'total_booking', true);
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
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);
$seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book);
$time = strtotime($event_expire_date);
$newformat = date('Y-m-d H:i:s',$time);
$datetime1 = new DateTime();
$datetime2 = new DateTime($newformat);
$interval = $datetime1->diff($datetime2);
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true);
$stc = 0;
$leftt = 0;
if (is_array($mep_event_ticket_type) || is_object($mep_event_ticket_type)){
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 = $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='';}
if($mep_event_ticket_type){
$seat_left = $leftt;
}else{
$seat_left = $seat_left;
}
$current = current_time('Y-m-d H:i:s');
$time = strtotime($event_expire_date);
$newformat = date('Y-m-d H:i:s',$time);
date_default_timezone_set(get_option('timezone_string'));
$datetime1 = new DateTime($newformat);
$datetime2 = new DateTime($current);
$interval = date_diff($datetime2, $datetime1);
// $days = $interval->days;
// $hours = $interval->h;
// $minutes = $interval->i;
// if($days>0){ $dd = $days." days "; }else{ $dd=""; }
// if($hours>0){ $hh = $hours." hours "; }else{ $hh=""; }
// if($minutes>0){ $mm = $minutes." minutes "; }else{ $mm=""; }
// echo "<span class='active'>$dd $hh $mm</span>";
if(time() > strtotime($newformat)){
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_event_expired_text', 'label_setting_sec') ? mep_get_option('mep_event_expired_text', 'label_setting_sec') : _e('Event Expired','mage-eventpress'); ?>
</span>
<?php
}
elseif($seat_left<=0){
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
</span>
<?php
do_action('mep_after_no_seat_notice');
}
else{
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);
if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0];
}else{
$mep_available_seat = 'on';
}
if($mep_event_ticket_type){
$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;
$hours = $interval->h;
$minutes = $interval->i;
if($days>0){ $dd = $days." days "; }else{ $dd=""; }
if($hours>0){ $hh = $hours." hours "; }else{ $hh=""; }
if($minutes>0){ $mm = $minutes." minutes "; }else{ $mm=""; }
$qty_typec = $event_meta['qty_box_type'][0];
if(array_key_exists('mep_reg_status', $event_meta)){
$reg_status = $event_meta['mep_reg_status'][0];
}else{
$reg_status = '';
}
if($reg_status!='off'){
?>
<!-- <h4 class="mep-cart-table-title">
<?php echo mep_get_option('mep_register_now_text', 'label_setting_sec') ? mep_get_option('mep_register_now_text', 'label_setting_sec') : _e('Register Now:','mage-eventpress'); ?>
</h4> -->
<form action="" method='post'>
<?php
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);
if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0];
}else{
$mep_available_seat = 'on';
}
if($mep_event_ticket_type){
$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;
}
if($leftt>0){
do_action('mep_event_ticket_types_list');
do_action('mep_event_extra_service_list');
}else{
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
</span>
<?php
do_action('mep_after_no_seat_notice');
}
if($leftt>0){
?>
<input type='hidden' id='rowtotal_<?php echo get_the_id(); ?>' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
<table>
<tr>
<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);
if($mep_event_ticket_type){ ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box_<?php echo get_the_id(); ?>" 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">
<span id="ttyttl_<?php echo get_the_id(); ?>"></span>
<?php
}else{
if($event_sqi==1){
$qmx = ($event_meta['mep_total_seat'][0]- $total_book);
if($qty_typec=='dropdown'){ ?>
<select name="quantity" id="quantity_5a7abbd1bff73" class='input-text qty text extra-qty-box_<?php echo get_the_id(); ?>'>
<?php for ($i = 1; $i <= $qmx; $i++) { ?>
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php } ?>
</select>
<?php }else{ ?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box_<?php echo get_the_id(); ?>" 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">
<?php
}
}else{
echo 1;
?>
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box_<?php echo get_the_id(); ?>" 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">
<?php
}
}
?>
<span class='the-total'>
<?php echo mep_get_option('mep_total_text', 'label_setting_sec') ? mep_get_option('mep_total_text', 'label_setting_sec') : _e('Total','mage-eventpress'); ?>
<span id="usertotal_<?php echo get_the_id(); ?>"></span></span>
</td>
<td align="right">
<input type="hidden" name="mep_event_location_cart" value="<?php trim(mep_ev_location_ticket($post_id,$event_meta)); ?>">
<input type="hidden" name="mep_event_date_cart" value="<?php do_action('mep_event_date'); ?>">
<p class="mep_no_tickt_notice" id="mep_btn_notice_<?php echo get_the_id(); ?>">
<?php echo mep_get_option('mep_no_ticket_selected_text', 'label_setting_sec') ? mep_get_option('mep_no_ticket_selected_text', 'label_setting_sec') : _e('No Ticket Selected!','mage-eventpress'); ?>
</p>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr($post_id); ?>" class="single_add_to_cart_button button alt btn-mep-event-cart_<?php echo get_the_id(); ?>"><?php _e(mep_get_label($post_id,'mep_cart_btn_text','Register This Event'),'mage-eventpress'); ?> </button>
</td>
</tr>
</table>
@ -201,3 +516,7 @@ if(!$mep_event_ticket_type){
}
}
}

View File

@ -2,37 +2,152 @@
add_action('mep_event_date','mep_ev_datetime');
function mep_ev_datetime(){
global $event_meta;
if(array_key_exists('mep_event_more_date', $event_meta)){
$more_date = unserialize($event_meta['mep_event_more_date'][0]);
}else{
$more_date = '';
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $event_meta['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
if ( array_key_exists( 'mep_event_more_date', $event_meta ) ) {
$more_date = unserialize( $event_meta['mep_event_more_date'][0] );
} else {
$more_date = array();
}
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
$mep_show_upcoming_event = get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) ? get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) : 'no';
$cn = 1;
if($recurring == 'yes'){
if(strtotime(current_time('Y-m-d H:i')) < strtotime($start_datetime)){
?>
<p><?php echo get_mep_datetime($start_datetime,'date-text').' '.get_mep_datetime($start_datetime,'time'); ?> - <?php if($start_date != $end_date){ echo get_mep_datetime($end_datetime,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></p>,
<?php
}
foreach ($more_date as $_more_date) {
if(strtotime(current_time('Y-m-d H:i')) < strtotime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'])){
if($mep_show_upcoming_event == 'yes'){
$cnt = 1;
}else{
$cnt = $cn;
}
if($cn == $cnt){
?>
<p><?php echo get_mep_datetime($_more_date['event_more_start_date'],'date-text').' '.get_mep_datetime($_more_date['event_more_start_time'],'time'); ?> - <?php if($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']){ echo get_mep_datetime($_more_date['event_more_end_date'],'date-text') .' - '; } echo get_mep_datetime($_more_date['event_more_end_time'],'time'); ?></p>
<?php
$cn++;
}
}
}
}elseif(is_array($more_date) && sizeof($more_date) > 0){
foreach ($more_date as $_more_date) {
?>
<p><?php echo get_mep_datetime($start_datetime,'date-text').' '.get_mep_datetime($start_datetime,'time'); ?> - <?php if($start_date != $end_date){ echo get_mep_datetime($end_datetime,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></p>,
<p><?php echo get_mep_datetime($_more_date['event_more_start_date'],'date-text').' '.get_mep_datetime($_more_date['event_more_start_time'],'time'); ?> - <?php if($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']){ echo get_mep_datetime($_more_date['event_more_end_date'],'date-text') .' - '; } echo get_mep_datetime($_more_date['event_more_end_time'],'time'); ?></p>
<?php
}
}else{
?>
<p><?php mep_get_full_time_and_date($event_meta['mep_event_start_date'][0]); if($more_date){ foreach ($more_date as $md) {
echo " - "; mep_get_full_time_and_date($md['event_more_date']);
} } else{ echo " - "; } ?> <?php if($more_date){ echo " - "; } mep_get_full_time_and_date($event_meta['mep_event_end_date'][0]); ?></p>
<p><?php echo get_mep_datetime($start_datetime,'date-text').' '.get_mep_datetime($start_datetime,'time'); ?> - <?php if($start_date != $end_date){ echo get_mep_datetime($end_datetime,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></p>
<?php
}
}
add_action('mep_event_date_default_theme','mep_date_in_default_theme');
function mep_date_in_default_theme(){
global $event_meta;
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $event_meta['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
// echo date('H:i A',strtotime($end_datetime));
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
$mep_show_upcoming_event = get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) ? get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) : 'no';
$cn = 1;
if ( array_key_exists( 'mep_event_more_date', $event_meta ) ) {
$more_date = unserialize( $event_meta['mep_event_more_date'][0] );
} else {
$more_date = '';
$more_date = array();
}
?>
<h3><i class="fa fa-calendar"></i> <?php echo esc_html( 'Event schedule details', 'mage-eventpress' ); ?></h3>
<?php
if($more_date){
mep_get_all_date_time( $event_meta['mep_event_start_date'][0], $more_date, $event_meta['mep_event_end_date'][0]);
echo '<ul>';
if($recurring == 'yes'){
if(strtotime(current_time('Y-m-d H:i')) < strtotime($start_datetime)){
?>
<li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($start_datetime,'date-text'); ?> <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,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></li>
<?php
}
foreach ($more_date as $_more_date) {
if(strtotime(current_time('Y-m-d H:i')) < strtotime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'])){
if($mep_show_upcoming_event == 'yes'){
$cnt = 1;
}else{
$cnt = $cn;
}
if($cn == $cnt){
?>
<li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'],'date-text'); ?> <i class="fa fa-clock-o"></i> <?php echo get_mep_datetime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'],'time'); ?> - <?php if($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']){ echo get_mep_datetime($_more_date['event_more_end_date'].' '.$_more_date['event_more_end_time'],'date-text') .' - '; } echo get_mep_datetime($_more_date['event_more_end_date'].' '.$_more_date['event_more_end_time'],'time'); ?></li>
<?php
$cn++;
}
}
}
}else{
if(is_array($more_date) && sizeof($more_date) > 0){
?>
<li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($start_datetime,'date-text'); ?> <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,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></li>
<?php
foreach ($more_date as $_more_date) {
?>
<li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'],'date-text'); ?> <i class="fa fa-clock-o"></i> <?php echo get_mep_datetime($_more_date['event_more_start_date'].' '.$_more_date['event_more_start_time'],'time'); ?> - <?php if($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']){ echo get_mep_datetime($_more_date['event_more_end_date'].' '.$_more_date['event_more_end_time'],'date-text') .' - '; } echo get_mep_datetime($_more_date['event_more_end_date'].' '.$_more_date['event_more_end_time'],'time'); ?></li>
<?php
}
}else{
echo get_single_date_time( $event_meta['mep_event_start_date'][0], $event_meta['mep_event_end_date'][0]);
?>
<li><i class="fa fa-calendar"></i> <?php echo get_mep_datetime($start_datetime,'date-text'); ?> <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,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></li>
<?php
}
}
echo '</ul>';
}
@ -44,32 +159,117 @@ function mep_date_in_default_theme(){
add_action('mep_event_date_only','mep_ev_date');
function mep_ev_date(){
global $event_meta;
?>
<p><?php echo date_i18n('d M Y', strtotime($event_meta['mep_event_start_date'][0])); ?> </p>
<?php
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $event_meta['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
$cn = 1;
$more_date =array($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
$mep_show_upcoming_event = get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) ? get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) : 'no';
if($recurring == 'yes'){
$event_more_dates = get_post_meta(get_the_id(),'mep_event_more_date',true);
foreach($event_more_dates as $md){
$more_date[] = $md['event_more_start_date'].' '.$md['event_more_start_time'];
}
foreach($more_date as $ev_date){
if(strtotime(current_time('Y-m-d H:i:s')) < strtotime($ev_date)){
if($mep_show_upcoming_event == 'yes'){
$cnt = 1;
}else{
$cnt = $cn;
}
if($cn == $cnt){
?>
<p><?php echo date_i18n('d M Y', strtotime($ev_date)); ?> </p>
<?php
$cn++;
}
}
}
}else{
?>
<p><?php echo date_i18n('d M Y', strtotime($start_datetime)); ?> </p>
<?php
}
}
add_action('mep_event_time_only','mep_ev_time');
function mep_ev_time(){
global $event_meta;
?>
<p><?php mep_get_only_time($event_meta['mep_event_start_date'][0]); ?> </p>
<?php
global $event_meta;
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $event_meta['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
$cn = 1;
$more_date =array($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
$mep_show_upcoming_event = get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) ? get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) : 'no';
if($recurring == 'yes'){
$event_more_dates = get_post_meta(get_the_id(),'mep_event_more_date',true);
foreach($event_more_dates as $md){
$more_date[] = $md['event_more_start_date'].' '.$md['event_more_start_time'];
}
foreach($more_date as $ev_date){
if(strtotime(current_time('Y-m-d H:i:s')) < strtotime($ev_date)){
if($mep_show_upcoming_event == 'yes'){
$cnt = 1;
}else{
$cnt = $cn;
}
if($cn == $cnt){
?>
<p><?php echo mep_get_only_time($ev_date); ?> </p>
<?php
$cn++;
}
}
}
}else{
?>
<p><?php mep_get_only_time($start_datetime); ?></p>
<?php
}
}
function mep_ev_time_ticket($event_meta){
// global $event_meta;
?>
<?php mep_get_only_time($event_meta['mep_event_start_date'][0]); ?>
<?php
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $event_meta['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
mep_get_only_time($start_datetime);
}
function mep_ev_date_ticket($event_meta){
// global $event_meta;
?>
<?php echo date_i18n('d M Y', strtotime($event_meta['mep_event_start_date'][0])); ?>
<?php
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$start_date = $event_meta['event_start_date'][0];
$start_time = $event_meta['event_start_time'][0];
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
$end_date = $_more_date['event_end_date'][0];
$end_time = $event_meta['event_end_time'][0];
echo date_i18n('d M Y', strtotime($start_datetime));
}

View File

@ -6,6 +6,7 @@ function mep_ev_ticket_type(){
global $post, $product,$event_meta;
$pid = $post->ID;
$count=1;
ob_start();
if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0];
@ -14,10 +15,12 @@ if(array_key_exists('mep_available_seat', $event_meta)){
}
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
?>
<?php echo "<h3 class='ex-sec-title'>".mep_get_label($pid,'mep_event_ticket_type_text','Ticket Type:
')."</h3>"; ?>
<input type="hidden" name='mep_event_start_date' value="<?php echo get_post_meta($post->ID, 'event_start_date', true); ?>">
<table>
<?php
$count =1;
@ -25,12 +28,12 @@ foreach ( $mep_event_ticket_type as $field ) {
$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_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>
<td align="Left"><?php echo $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 class="ticket-qty">
<span class="tkt-qty">
@ -70,4 +73,6 @@ if($qty_t_type=='dropdown'){ ?>
<?php
}
$content = ob_get_clean();
echo apply_filters('mage_event_ticket_type_list', $content,$pid,$event_meta);
}

View File

@ -1,78 +1,22 @@
<?php
function mep_output_add_to_cart_custom_fields() {
global $post,$event_meta,$total_book;
$total_seat = mep_event_total_seat(get_the_id(),'total');
$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(array_key_exists('mep_rsv_seat', $event_meta)){
$simple_rsv = $event_meta['mep_rsv_seat'][0];
if($total_left>0){
do_action('mep_event_ticket_types');
do_action('mep_event_extra_service');
}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);
if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0];
}else{
$mep_available_seat = 'on';
}
if($mep_event_ticket_type){
$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;
}
if($leftt>0){
do_action('mep_event_ticket_types');
do_action('mep_event_extra_service');
}
else{
?>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
</span>
<span class=event-expire-btn>
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
</span>
<?php
do_action('mep_after_no_seat_notice');
}
}
}
add_action( 'mep_event_ticket_type_extra_service', 'mep_output_add_to_cart_custom_fields', 10 );

View File

@ -2,7 +2,8 @@
add_action('mep_event_seat','mep_ev_seat');
function mep_ev_seat(){
global $post,$event_meta;
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
if($recurring == 'no'){
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if(array_key_exists('mep_available_seat', $event_meta)){
$mep_available_seat = $event_meta['mep_available_seat'][0];
@ -19,3 +20,4 @@ $mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true)
<?php
}
}
}

View File

@ -3,13 +3,14 @@
* Plugin Name: Woocommerce Events Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 2.8.0
* Version: 3.0.0
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress
* Domain Path: /languages/
*/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
@ -45,7 +46,80 @@ function mep_flash_permalink_once() {
}
add_action( 'admin_init', 'mep_flash_permalink_once' );
// add_action( 'admin_init', 'mep_check_builder_status' );
add_action( 'admin_notices', 'mep_check_pro_plugin_version' );
function mep_check_pro_plugin_version(){
$version = '3.4';
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 ) {
$class = 'notice notice-error';
printf(
'<div class="error" style="background:#fff; color:#dc3232;"><p style="font-size: 15px;">%s</p></div>',
__('<b>Woocommerce Event Manager 3.0.0</b> Need <b>Woocommerce Event Manager Addon: Form Builder Version 3.4.0</b> For Fully Working, Please update your <b>Woocommerce Event Manager Addon: Form Builder Plugin to 3.4.0</b> If you do no see the update notification please contact <a style="background: #0909c7;color: #fff;display: inline-block;padding: 1px 10px;text-decoration: none;" href="https://mage-people.com/submit-ticket/" target="_blank">Our Support</a> To get Update Version')
);
}
}else{
return true;
}
$version = '3.2';
if(is_plugin_active( 'woocommerce-event-manager-pdf-ticket/tickets.php' )){
$data = get_plugin_data( ABSPATH . "wp-content/plugins/woocommerce-event-manager-pdf-ticket/tickets.php", false, false );
if ( is_plugin_active( 'woocommerce-event-manager-pdf-ticket/tickets.php' ) && $data['Version'] >= $version ) {
return true;
}elseif ( is_plugin_active( 'woocommerce-event-manager-pdf-ticket/tickets.php' ) && $data['Version'] < $version ) {
$class = 'notice notice-error';
printf(
'<div class="error" style="background:#fff; color:#dc3232;"><p style="font-size: 15px;">%s</p></div>',
__('<b>Woocommerce Event Manager 3.0.0</b> Need <b>Woocommerce Event Manager Addon: PDF Tickets Version 3.2.0</b> For Fully Working, Please update your <b>Woocommerce Event Manager Addon: PDF Tickets Version 3.2.0</b> If you do no see the update notification please contact <a style="background: #0909c7;color: #fff;display: inline-block;padding: 1px 10px;text-decoration: none;" href="https://mage-people.com/submit-ticket/" target="_blank">Our Support</a> To get Update Version')
);
}
}else{
return true;
}
}
function mep_check_builder_status(){
$version = '3.2';
@ -240,13 +314,9 @@ global $wpdb;
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10);
function mep_event_booking_management( $order_id) {
if(mep_check_builder_status()){
if ( ! $order_id )
return;
function mep_attendee_create($type,$order_id,$event_id,$_user_info = array()){
// Getting an instance of the order object
$order = wc_get_order( $order_id );
@ -254,59 +324,56 @@ $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+)
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
$event_id = wc_get_order_item_meta($item_id,'event_id',true);
if (get_post_type($event_id) == 'mep_events') {
$event_name = get_the_title($event_id);
$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'];
}
}
$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($type == 'billing'){
// Billing Information
$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] : '';
$uname = $first_name.' '.$last_name;
$company = 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] : '';
$address = $address_1.' '.$address_2;
$gender = '';
$designation = '';
$website = '';
$vegetarian = '';
$tshirtsize = '';
$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] : '';
$ticket_type = $_user_info['ticket_name'];
$event_date = $_user_info['event_date'];
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
}elseif($type == 'user_form'){
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(
$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'];
$event_date = $_user_info['user_event_date'];
$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'] : "";
}
$new_post = array(
'post_title' => $uname,
'post_content' => '',
'post_category' => array(), // Usable for custom taxonomies too
@ -317,7 +384,7 @@ foreach ( $order->get_items() as $item_id => $item_values ) {
//SAVE THE 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_address_1', $address);
update_post_meta( $pid, 'ea_email', $email);
@ -330,11 +397,12 @@ foreach ( $order->get_items() as $item_id => $item_values ) {
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_name', get_the_title($event_id));
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_event_date', $event_date);
update_post_meta( $pid, 'ea_order_status', $order_status);
// Checking if the form builder addon is active and have any custom fields
@ -345,56 +413,84 @@ foreach ( $order->get_items() as $item_id => $item_values ) {
}
} // 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
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10);
function mep_event_booking_management( $order_id) {
if(mep_check_builder_status()){
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
);
if ( ! $order_id )
return;
//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'];
// Getting an instance of the order object
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
$order_status = $order->get_status();
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);
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
if($form_position=='checkout_page'){
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
}
$event_id = wc_get_order_item_meta($item_id,'event_id',true);
if (get_post_type($event_id) == 'mep_events') {
$event_name = get_the_title($event_id);
$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'];
}
}
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
mep_attendee_create('user_form',$order_id,$event_id,$_user_info);
}
}else{
foreach($event_ticket_info_arr as $tinfo){
for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) {
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
}
}
}
}
}else{
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
$event_id = wc_get_order_item_meta($item_id,'event_id',true);
if (get_post_type($event_id) == 'mep_events') {
$event_name = get_the_title($event_id);
$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'];
}
}
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
mep_attendee_create('user_form',$order_id,$event_id,$_user_info);
}
}else{
foreach($event_ticket_info_arr as $tinfo){
for ($x = 1; $x <= $tinfo['ticket_qty']; $x++) {
mep_attendee_create('billing',$order_id,$event_id,$tinfo);
}
}
}
} // end of check post type
}
} // end of check post type
}
do_action('mep_after_event_booking',$order_id,$order->get_status());
}
@ -402,6 +498,7 @@ 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);
function mep_event_order_status_make_pending($order_id)
@ -460,15 +557,53 @@ function change_attandee_order_status($order_id,$set_status,$post_status,$qr_sta
function change_wc_event_product_status($order_id,$set_status,$post_status,$qr_status=null){
$args = array (
'post_type' => array( 'product' ),
'posts_per_page' => -1,
'post_status' => $post_status,
'meta_query' => array(
array(
'key' => 'link_mep_event',
'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' ) {
if ( $post_type == 'shop_order' ) {
change_attandee_order_status( $post_id, 'trash', 'publish', '' );
}
if ( $post_type == 'mep_events' ) {
change_wc_event_product_status( $post_id, 'trash', 'publish', '' );
}
}
@ -481,6 +616,11 @@ function mep_addendee_untrash( $post_id ) {
$order_status = $order->get_status();
change_attandee_order_status( $post_id, 'publish', 'trash', '' );
}
if ( $post_type == 'mep_events' ) {
change_wc_event_product_status( $post_id, 'publish', 'trash', '' );
}
}
@ -752,22 +892,68 @@ function mep_attendee_filter_query($query) {
$q_vars['meta_value'] = $_GET['meta_value'];
}
if ( $pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == $post_type && isset($_GET['event_id']) && $_GET['event_id'] != 0 ) {
$q_vars['meta_key'] = 'ea_event_id';
$q_vars['meta_value'] = $_GET['event_id'];
$q_vars['meta_key'] = 'ea_event_date';
$q_vars['meta_value'] = $_GET['ea_event_date'];
}
}
// 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 );
function mep_custom_event_column( $column, $post_id ) {
switch ( $column ) {
case 'mep_status' :
$values = get_post_custom( $post_id );
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'mep_event_start_date');
echo mep_get_event_status($values[$event_expire_on][0]);
break;
case 'mep_status' :
$values = get_post_custom( $post_id );
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
if($recurring == 'yes'){
$event_more_dates = get_post_meta($post_id,'mep_event_more_date',true);
$seat_left = 10;
$md = end($event_more_dates);
$more_date = $md['event_more_start_date'].' '.$md['event_more_start_time'];
$event_date = date('Y-m-d H:i:s',strtotime($more_date));
}else{
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetime', 'general_setting_sec', 'event_start_date');$event_date = $values['event_start_date'][0].' '.$values['event_start_time'][0];
}
echo mep_get_event_status($event_date);
break;
case 'mep_atten' :
echo '<a class="button button-primary button-large" href="'.get_site_url().'/wp-admin/edit.php?post_type=mep_events_attendees&meta_value='.$post_id.'">Attendees List</a>';
$multi_date = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array();
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
// print_r($multi_date);
?>
<form action="" method="get">
<select name="ea_event_date" id="" style='font-size: 14px;border: 1px solid blue;width: 110px;display:<?php if($recurring == 'yes'){ echo 'block'; }else{ echo 'none'; } ?>'>
<option value="<?php echo get_post_meta($post_id,'event_start_date',true).' '.get_post_meta($post_id,'event_start_time',true); ?>"><?php echo get_mep_datetime(get_post_meta($post_id,'event_start_date',true),'date-text').' '.get_mep_datetime(get_post_meta($post_id,'event_start_date',true).' '.get_post_meta($post_id,'event_start_time',true),'time'); ?></option>
<?php foreach($multi_date as $multi){ ?>
<option value="<?php echo $multi['event_more_start_date'].' '.$multi['event_more_start_time']; ?>"><?php echo get_mep_datetime($multi['event_more_start_date'],'date-text').' '.get_mep_datetime($multi['event_more_start_time'],'time'); ?></option>
<?php } ?>
</select>
<input type="hidden" name='post_type' value='mep_events_attendees'>
<input type="hidden" name='event_id' value='<?php echo $post_id; ?>'>
<button class="button button-primary button-large">Attendees List</button>
</form>
<?php
// echo '<button class="button button-primary button-large" href="'.get_site_url().'/wp-admin/edit.php?post_type=mep_events_attendees&meta_value='.$post_id.'">Attendees List</button></form>';
break;
}
}
@ -917,8 +1103,8 @@ return $newformat;
function mep_add_to_google_calender_link($pid){
$event = get_post($pid);
$event_meta = get_post_custom($pid);
$event_start = $event_meta['mep_event_start_date'][0];
$event_end = $event_meta['mep_event_end_date'][0];
$event_start = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
$event_end = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][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();
@ -1050,7 +1236,7 @@ ob_start();
$event_id = get_post_meta( get_the_id(), 'ea_event_id', true );
$event_meta = get_post_custom($event_id);
$time = strtotime($event_meta['mep_event_start_date'][0]);
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
$newformat = date('Y-m-d H:i:s',$time);
@ -1253,13 +1439,19 @@ function mep_set_custom_edit_event_columns($columns) {
function mep_get_full_time_and_date($datetime){
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
$wpdatesettings = $date_format.' '.$time_format;
$user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12);
if($user_set_format==12){
echo date_i18n('D, d M Y h:i A', strtotime($datetime));
echo date_i18n('D, d M Y h:i A', strtotime($datetime));
}
if($user_set_format==24){
echo date_i18n('D, d M Y H:i', strtotime($datetime));
echo date_i18n('D, d M Y H:i', strtotime($datetime));
}
if($user_set_format=='wtss'){
echo date_i18n($wpdatesettings, strtotime($datetime));
}
}
@ -1267,16 +1459,20 @@ function mep_get_full_time_and_date($datetime){
function mep_get_only_time($datetime){
$user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12);
if($user_set_format==12){
//echo $date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
if($user_set_format==12){
echo date_i18n('h:i A', strtotime($datetime));
}
if($user_set_format==24){
echo date_i18n('H:i', strtotime($datetime));
}
if($user_set_format=='wtss'){
echo date_i18n($time_format, strtotime($datetime));
}
}
function mep_get_event_city($id){
$location_sts = get_post_meta($id,'mep_org_address',true);
$event_meta = get_post_custom($id);
@ -1322,17 +1518,53 @@ function mep_event_org_location_item($event_id,$item_name){
function mep_get_all_date_time( $start_datetime, $more_datetime, $end_datetime ) {
ob_start();
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
$wpdatesettings = $date_format.$time_format;
$user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12);
?>
<ul>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n( 'l,d M Y', strtotime( $start_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( 'h:i A', strtotime( $start_datetime ) ); ?></li>
<?php if($user_set_format==12){ ?>
<?php $timeformatassettings = 'h:i A'; ?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n($date_format, strtotime( $start_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( 'h:i A', strtotime( $start_datetime ) ); ?></li>
<?php } ?>
<?php if($user_set_format==24){ ?>
<?php $timeformatassettings = 'H:i'; ?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n($date_format, strtotime( $start_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( 'H:i', strtotime( $start_datetime ) ); ?></li>
<?php } ?>
<?php if($user_set_format=='wtss'){ ?>
<?php $timeformatassettings = get_option( 'time_format' ); ?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n($date_format, strtotime( $start_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( $time_format, strtotime( $start_datetime ) ); } ?></li>
}
}
?>
<?php
foreach ( $more_datetime as $_more_datetime ) {
?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n( 'l,d M Y', strtotime( $_more_datetime['event_more_date'] ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( 'h:i A', strtotime( $_more_datetime['event_more_date'] ) ) ?></li>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n($date_format, strtotime( $_more_datetime['event_more_date'] ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n($timeformatassettings, strtotime( $_more_datetime['event_more_date'] ) ) ?></li>
<?php
}
?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n( 'l,d M Y', strtotime( $end_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n( 'h:i A', strtotime( $end_datetime ) ); ?> <span style='font-size: 12px;font-weight: bold;'>(<?php _e('End','mage-eventpress'); ?>)</span></li>
<?php
if($user_set_format==12){
$timeformatassettings = 'h:i A';
}
if($user_set_format==24){
$timeformatassettings = 'H:i';
}
if($user_set_format=='wtss'){
$timeformatassettings = get_option( 'time_format' );
}
?>
<li><i class="fa fa-calendar"></i> <?php echo date_i18n($date_format, strtotime( $end_datetime ) ); ?> <i class="fa fa-clock-o"></i> <?php echo date_i18n($timeformatassettings, strtotime( $end_datetime ) ); ?> <span style='font-size: 12px;font-weight: bold;'>(<?php _e('End','mage-eventpress'); ?>)</span></li>
</ul>
<?php
$content = ob_get_clean();
@ -1341,14 +1573,18 @@ echo $content;
function get_single_date_time( $start_datetime, $end_datetime ) {
$start_date = date_i18n( 'Y-m-d', strtotime( $start_datetime ) );
$end_date = date_i18n( 'Y-m-d', strtotime( $end_datetime ) );
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
$wpdatesettings = $date_format.$time_format;
$nameOfDay = date_i18n( 'l,d M Y', strtotime( $start_date ) );
$nameOfDayEnd = date_i18n( 'l,d M Y', strtotime( $end_date ) );
$start_date = date_i18n( $date_format, strtotime( $start_datetime ) );
$end_date = date_i18n( $date_format, strtotime( $end_datetime ) );
$start_time = date_i18n( 'h:i A', strtotime( $start_datetime ) );
$end_time = date_i18n( 'h:i A', strtotime( $end_datetime ) );
$nameOfDay = date_i18n( $date_format, strtotime( $start_date ) );
$nameOfDayEnd = date_i18n( $date_format, strtotime( $end_date ) );
$start_time = date_i18n($time_format, strtotime( $start_datetime ) );
$end_time = date_i18n($time_format, strtotime( $end_datetime ) );
if ( $start_date == $end_date ) {
return $nameOfDay . " " . $start_time . " - " . $end_time;
@ -1507,10 +1743,35 @@ function mep_save_attendee_info_into_cart($product_id){
$mep_user_vegetarian = $_POST['vegetarian'];
}else{ $mep_user_vegetarian=""; }
if(isset($_POST['ticket_type'])){
$mep_user_ticket_type = $_POST['ticket_type'];
}else{ $mep_user_ticket_type=""; }
if(isset($_POST['event_date'])){
$event_date = $_POST['event_date'];
}else{ $event_date=""; }
if(isset($_POST['mep_event_id'])){
$mep_event_id = $_POST['mep_event_id'];
}else{ $mep_event_id=""; }
// print_r($event_date);
// die();
if(isset($_POST['mep_ucf'])){
$mep_user_cfd = $_POST['mep_ucf'];
}else{
@ -1565,6 +1826,15 @@ function mep_save_attendee_info_into_cart($product_id){
$user[$iu]['user_ticket_type'] = stripslashes( strip_tags( $mep_user_ticket_type[$iu] ) );
endif;
if (isset($event_date[$iu])) :
$user[$iu]['user_event_date'] = stripslashes( strip_tags( $event_date[$iu] ) );
endif;
if (isset($mep_event_id[$iu])) :
$user[$iu]['user_event_id'] = stripslashes( strip_tags( $mep_event_id[$iu] ) );
endif;
$mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true);
if ( $mep_form_builder_data ) {
foreach ( $mep_form_builder_data as $_field ) {
@ -1620,14 +1890,20 @@ function mep_wc_price( $price, $args = array() ) {
function mep_get_event_total_seat($event_id){
function mep_get_event_total_seat($event_id,$m=null,$t=null){
$total_seat = mep_event_total_seat($event_id,'total');
$total_resv = mep_event_total_seat($event_id,'resv');
$total_sold = mep_ticket_sold($event_id);
$total_left = $total_seat - ($total_sold + $total_resv);
if($t=='multi'){
?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo $total_left; ?>/<?php echo $total_seat; ?> </span>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo ($total_seat * $m) - ($total_sold + $total_resv); ?>/<?php echo $total_seat * $m; ?> </span>
<?php
}else{
?>
<span style="background: #dc3232;color: #fff;padding: 5px 10px;"> <?php echo $total_left; ?>/<?php echo $total_seat; ?> </span>
<?php
}
}
@ -1687,7 +1963,16 @@ function mep_mep_events_column( $column, $post_id ) {
switch ( $column ) {
case 'mep_event_seat' :
echo mep_get_event_total_seat($post_id);
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
if($recurring == 'yes'){
$event_more_dates = count(get_post_meta($post_id,'mep_event_more_date',true))+1;
echo mep_get_event_total_seat($post_id,$event_more_dates,'multi');
}else{
echo mep_get_event_total_seat($post_id);
}
break;
}
}
@ -1708,8 +1993,8 @@ function mep_get_term_as_class($post_id,$taxonomy){
}
function mep_ticket_type_sold($event_id,$type){
function mep_ticket_type_sold($event_id,$type,$date){
//echo $date;
$args = array(
'post_type' => 'mep_events_attendees',
'posts_per_page' => -1,
@ -1727,6 +2012,11 @@ function mep_ticket_type_sold($event_id,$type){
'key' => 'ea_ticket_type',
'value' => $type,
'compare' => '='
),
array(
'key' => 'ea_event_date',
'value' => $date,
'compare' => 'LIKE'
)
),array(
'relation' => 'OR',
@ -1788,6 +2078,7 @@ 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;
if(is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 0){
foreach ( $mep_event_ticket_type as $field ) {
if($type == 'total'){
$total_name = (int) $field['option_qty_t'];
@ -1796,9 +2087,231 @@ function mep_event_total_seat($event_id,$type){
}
$total = $total_name + $total;
}
}
return $total;
}
function get_mep_datetime($date,$type){
$user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12);
if($type == 'date'){
return date_i18n( 'Y-m-d', strtotime( $date ) );
}
if($type == 'date-time'){
if($user_set_format == 12){
return date_i18n( 'Y-m-d h:i A', strtotime( $date ) );
}else{
return date_i18n( 'Y-m-d H:i', strtotime( $date ) );
}
}
if($type == 'date-text'){
return date_i18n( 'd,D M Y', strtotime( $date ) );
}
if($type == 'date-time-text'){
if($user_set_format == 12){
return date_i18n( 'd,D M Y h:i A', strtotime( $date ) );
}else{
return date_i18n( 'd,D M Y H:i', strtotime( $date ) );
}
}
if($type == 'time'){
if($user_set_format == 12){
return date( 'h:i A', strtotime( $date ) );
}else{
return date( 'H:i', strtotime( $date ) );
}
}
}
function on_post_publish( $post_id, $post, $update ) {
if ($post->post_type == 'mep_events' && $post->post_status == 'publish' && empty(get_post_meta( $post_id, 'check_if_run_once' ))) {
// print_r($post);
// ADD THE FORM INPUT TO $new_post ARRAY
$new_post = array(
'post_title' => $post->post_title,
'post_content' => '',
'post_category' => array(), // Usable for custom taxonomies too
'tags_input' => array(),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'product' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
update_post_meta( $post_id, 'link_wc_product', $pid );
update_post_meta( $pid, 'link_mep_event', $post_id );
update_post_meta( $pid, '_price', 0.01 );
update_post_meta( $pid, '_sold_individually', 'yes' );
update_post_meta( $pid, '_virtual', 'yes' );
$terms = array( 'exclude-from-catalog', 'exclude-from-search' );
wp_set_object_terms( $pid, $terms, 'product_visibility' );
update_post_meta( $post_id, 'check_if_run_once', true );
//die();
}
}
add_action( 'wp_insert_post', 'on_post_publish', 10, 3 );
add_action('parse_query', 'product_tags_sorting_query');
function product_tags_sorting_query($query) {
global $pagenow;
$taxonomy = 'product_visibility';
$q_vars = &$query->query_vars;
if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == 'product') {
$term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
$tax_query = array([
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => 'exclude-from-catalog',
'operator' => 'NOT IN',
]);
$query->set( 'tax_query', $tax_query );
// $q_vars[$taxonomy] = 'exclude-from-catalog';
}
}
function get_event_list_js($id,$event_meta,$currency_pos){
ob_start();
?>
<script>
jQuery(document).ready( function() {
jQuery(document).on("change", ".etp_<?php echo $id; ?>", function() {
var sum = 0;
jQuery(".etp_<?php echo $id; ?>").each(function(){
sum += +jQuery(this).val();
});
jQuery("#ttyttl_<?php echo $id; ?>").html(sum);
});
jQuery(".extra-qty-box_<?php echo $id; ?>").on('change', function() {
var sum = 0;
var total = <?php if($event_meta['_price'][0]){ echo $event_meta['_price'][0]; }else{ echo 0; } ?>;
jQuery('.price_jq_<?php echo $id; ?>').each(function () {
var price = jQuery(this);
var count = price.closest('tr').find('.extra-qty-box_<?php echo $id; ?>');
sum = (price.html() * count.val());
total = total + sum;
// price.closest('tr').find('.cart_total_price').html(sum + "â‚´");
});
jQuery('#usertotal_<?php echo $id; ?>').html("<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>" + total + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
jQuery('#rowtotal_<?php echo $id; ?>').val(total);
}).change(); //trigger change event on page load
<?php
$mep_event_ticket_type = get_post_meta($id, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
$count =1;
foreach ( $mep_event_ticket_type as $field ) {
$qm = $field['option_name_t'];
?>
//jQuery('.btn-mep-event-cart').hide();
jQuery('.btn-mep-event-cart_<?php echo $id; ?>').attr('disabled','disabled');
jQuery('#eventpxtp_<?php echo $id; ?>_<?php echo $count; ?>').on('change', function () {
var inputs = jQuery("#ttyttl_<?php echo $id; ?>").html() || 0;
var inputs = jQuery('#eventpxtp_<?php echo $id; ?>_<?php echo $count; ?>').val() || 0;
var input = parseInt(inputs);
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
jQuery(document).on("change", ".etp_<?php echo $id; ?>", function() {
var TotalQty = 0;
jQuery(".etp_<?php echo $id; ?>").each(function(){
TotalQty += +jQuery(this).val();
});
//alert(sum);
if(TotalQty == 0){
//jQuery('.btn-mep-event-cart').hide();
jQuery('.btn-mep-event-cart_<?php echo $id; ?>').attr('disabled','disabled');
jQuery('#mep_btn_notice_<?php echo $id; ?>').show();
}else{
//jQuery('.btn-mep-event-cart').show();
jQuery('.btn-mep-event-cart_<?php echo $id; ?>').removeAttr('disabled');
jQuery('#mep_btn_notice_<?php echo $id; ?>').hide();
}
});
if(input < children){
jQuery('#dadainfo_<?php echo $count; ?>').empty();
children=0;
}
for (var i = children+1; i <= input; i++) {
jQuery('#dadainfo_<?php echo $count; ?>').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
.html("<?php do_action("mep_reg_fields",$id); ?>")
);
}
});
<?php
$count++;
}
}else{
?>
jQuery('#mep_btn_notice_<?php echo $id; ?>').hide();
jQuery('#quantity_5a7abbd1bff73').on('change', function () {
var input = jQuery('#quantity_5a7abbd1bff73').val() || 0;
var children=jQuery('#divParent > div').length || 0;
if(input < children){
jQuery('#divParent').empty();
children=0;
}
for (var i = children+1; i <= input; i++) {
jQuery('#divParent').append(
jQuery('<div/>')
.attr("id", "newDiv" + i)
.html("<?php do_action('mep_reg_fields',$id); ?>")
);
}
});
<?php
}
?>
});
</script>
<?php
echo $content = ob_get_clean();
}
}else{
function mep_admin_notice_wc_not_active() {
$class = 'notice notice-error';