just file update with fix function prefix name
This commit is contained in:
parent
65c9b25c19
commit
f3ff468742
|
@ -94,7 +94,7 @@ class MAGE_Events_Setting_Controls {
|
|||
'desc' => __( 'Event Details Template', 'mage-eventpress' ),
|
||||
'type' => 'select',
|
||||
'default' => 'no',
|
||||
'options' => event_template_name()
|
||||
'options' => mep_event_template_name()
|
||||
),
|
||||
array(
|
||||
'name' => 'mep_event_price_show',
|
||||
|
|
|
@ -20,7 +20,7 @@ if($user_api){
|
|||
}
|
||||
|
||||
|
||||
function add_admin_scripts( $hook ) {
|
||||
function mep_add_admin_scripts( $hook ) {
|
||||
|
||||
global $post;
|
||||
|
||||
|
@ -36,7 +36,7 @@ function add_admin_scripts( $hook ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'add_admin_scripts', 10, 1 );
|
||||
add_action( 'admin_enqueue_scripts', 'mep_add_admin_scripts', 10, 1 );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -902,11 +902,17 @@ function mep_event_ticket_type() {
|
|||
var row = $( '.empty-row-t.screen-reader-text' ).clone(true);
|
||||
row.removeClass( 'empty-row-t screen-reader-text' );
|
||||
row.insertBefore( '#repeatable-fieldset-one-t tbody>tr:last' );
|
||||
jQuery('#mep_ticket_type_empty option[value=inputbox]').attr('selected','selected');
|
||||
jQuery('.empty-row-t #mep_ticket_type_empty option[value=inputbox]').removeAttr('selected');
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.remove-row-t' ).on('click', function() {
|
||||
$(this).parents('tr').remove();
|
||||
// $("selector").removeAttr(attribute);
|
||||
jQuery('#mep_ticket_type_empty option[value=inputbox]').removeAttr('selected');
|
||||
jQuery('#mep_ticket_type_empty option[value=dropdown]').removeAttr('selected');
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
@ -973,7 +979,9 @@ $opt_rst_qty = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
|
|||
<td><input type="number" size="2" pattern="[0-9]*" class="widefat" name="option_default_qty_t[]" placeholder="Ex: 1" value="" /></td>
|
||||
<?php echo $option_rsv_t = '<td><input type="number" class="widefat" name="option_rsv_t[]" placeholder="Ex: 5" value=""/></td>'?>
|
||||
<?php apply_filters('mep_add_field_to_ticket_type', $option_rsv_t); ?>
|
||||
<td><select name="option_qty_t_type[]" id="mep_ev_9800kj8" class=''><option value=""><?php _e('Please Select Type','mage-eventpress'); ?></option><option value="inputbox"><?php _e('Input Box','mage-eventpress'); ?></option><option value="dropdown"><?php _e('Dropdown List','mage-eventpress'); ?></option></select></td>
|
||||
<td>
|
||||
<select name="option_qty_t_type[]" id="mep_ticket_type_empty" class=''>
|
||||
<option value=''>Please Select</option><option value="inputbox"><?php _e('Input Box','mage-eventpress'); ?></option><option value="dropdown"><?php _e('Dropdown List','mage-eventpress'); ?></option></select></td>
|
||||
<td>
|
||||
|
||||
<button class="button remove-row-t"><span class="dashicons dashicons-trash" style="margin-top: 3px;color: red;"></span><?php _e('Remove','mage-eventpress'); ?></button>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
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;
|
||||
|
||||
$recurring = get_post_meta($product_id, 'mep_enable_recurring', true) ? get_post_meta($product_id, 'mep_enable_recurring', true) : 'no';
|
||||
if (get_post_type($product_id) == 'mep_events') {
|
||||
$tp = get_post_meta($product_id,'_price',true);
|
||||
|
||||
|
@ -147,10 +147,17 @@ if(isset($_POST['mep_event_ticket_type'])){
|
|||
$cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($recurring == 'yes'){
|
||||
$recurring_event_date = isset($_POST['recurring_event_date']) ? $_POST['recurring_event_date'] : array();
|
||||
}else{
|
||||
$recurring_event_date = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$cart_item_data['event_ticket_info'] = $ticket_type_arr;
|
||||
$cart_item_data['event_validate_info'] = $validate;
|
||||
$cart_item_data['event_validate_info'] = $validate;
|
||||
$cart_item_data['event_extra_option'] = $new;
|
||||
$cart_item_data['event_user_info'] = $user;
|
||||
$cart_item_data['event_tp'] = $tp;
|
||||
|
@ -159,6 +166,8 @@ if(isset($_POST['mep_event_ticket_type'])){
|
|||
$cart_item_data['event_extra_service'] = $event_extra;
|
||||
$cart_item_data['event_cart_location'] = $event_cart_location;
|
||||
$cart_item_data['event_cart_date'] = $mep_event_start_date;
|
||||
$cart_item_data['event_recurring_date'] = array_unique($recurring_event_date);
|
||||
$cart_item_data['event_recurring_date_arr'] = $recurring_event_date;
|
||||
// $cart_item_data['event_cart_date'] = $event_cart_date;
|
||||
}
|
||||
$cart_item_data['event_id'] = $product_id;
|
||||
|
@ -169,8 +178,8 @@ add_filter( 'woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_car
|
|||
|
||||
|
||||
|
||||
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price',90,1 );
|
||||
function add_custom_price( $cart_object ) {
|
||||
add_action( 'woocommerce_before_calculate_totals', 'mep_add_custom_price',90,1 );
|
||||
function mep_add_custom_price( $cart_object ) {
|
||||
|
||||
foreach ( $cart_object->cart_contents as $key => $value ) {
|
||||
$eid = $value['event_id'];
|
||||
|
@ -197,11 +206,23 @@ $eid = $cart_item['event_id'];
|
|||
if (get_post_type($eid) == 'mep_events') {
|
||||
$user_info = $cart_item['event_user_info'];
|
||||
$ticket_type_arr = $cart_item['event_ticket_info'];
|
||||
$event_extra_service = $cart_item['event_extra_service'];
|
||||
$event_extra_service = $cart_item['event_extra_service'];
|
||||
$event_recurring_date = $cart_item['event_recurring_date'];
|
||||
|
||||
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
echo "<ul class='event-custom-price'>";
|
||||
|
||||
if($recurring == 'yes'){
|
||||
if(is_array($event_recurring_date) && sizeof($event_recurring_date) > 0){
|
||||
foreach($event_recurring_date as $_event_recurring_date){
|
||||
?>
|
||||
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo get_mep_datetime($_event_recurring_date, 'date-time-text'); //date('D, d M Y H:i:s',strtotime($_event_recurring_date)); ?></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
if(is_array($user_info) && sizeof($user_info) > 0){
|
||||
foreach($user_info as $userinf){
|
||||
?>
|
||||
|
@ -213,10 +234,12 @@ if(is_array($user_info) && sizeof($user_info) > 0){
|
|||
<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 Location','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; //echo $cart_item['event_ticket_type']; ?></li>
|
||||
<?php
|
||||
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $ticket){
|
||||
echo '<li>'.$ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = '.wc_price($ticket['ticket_price'] * $ticket['ticket_qty']).'</li>';
|
||||
|
@ -258,7 +281,7 @@ function mep_checkout_validation( $posted ) {
|
|||
}
|
||||
if($ee > $total_left) {
|
||||
$event = get_the_title($event_id);
|
||||
wc_add_notice( __( "Sorry, Seats are not available in <b>$event</b>, Available Seats <b>$total_left</b> but you selected <b>$ee</b>", 'mage-eventpress' ), 'error' );
|
||||
wc_add_notice( __( "Sorry, Seats are not available in <b>$event</b>, Available Seats <b>$total_left</b> but you selected <b>$ee</b>", 'mage-eventpress' ), 'error' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,98 +296,83 @@ function mep_checkout_validation( $posted ) {
|
|||
|
||||
|
||||
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'];
|
||||
if(isset($values['event_ticket_type'])){
|
||||
$event_ticket_type = $values['event_ticket_type'];
|
||||
}else{
|
||||
$event_ticket_type = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_price'])){
|
||||
$event_ticket_price = $values['event_ticket_price'];
|
||||
}else{
|
||||
$event_ticket_price = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_qty'])){
|
||||
$event_ticket_qty = $values['event_ticket_qty'];
|
||||
}else{
|
||||
$event_ticket_qty = " ";
|
||||
}
|
||||
|
||||
|
||||
$eid = $values['event_id'];
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$mep_events_extra_prices = $values['event_extra_option'];
|
||||
if(isset($values['event_ticket_type'])){
|
||||
$event_ticket_type = $values['event_ticket_type'];
|
||||
}else{
|
||||
$event_ticket_type = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_price'])){
|
||||
$event_ticket_price = $values['event_ticket_price'];
|
||||
}else{
|
||||
$event_ticket_price = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_qty'])){
|
||||
$event_ticket_qty = $values['event_ticket_qty'];
|
||||
}else{
|
||||
$event_ticket_qty = " ";
|
||||
}
|
||||
|
||||
$user_set_format = mep_get_option( 'mep_event_time_format','general_setting_sec',12);
|
||||
$date_format = get_option( 'date_format' );
|
||||
$time_format = get_option( 'time_format' );
|
||||
$wpdatesettings = $date_format.' '.$time_format;
|
||||
|
||||
if($user_set_format == 12){
|
||||
$cart_date = date_i18n( 'Y-m-d h:i A', strtotime( $values['event_cart_date'] ) );
|
||||
}elseif($user_set_format == 24){
|
||||
$cart_date = date_i18n( 'Y-m-d H:i', strtotime( $values['event_cart_date'] ) );
|
||||
}elseif($user_set_format == 'wtss'){
|
||||
$cart_date = date_i18n( $wpdatesettings, strtotime( $values['event_cart_date'] ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$product_id = $values['product_id'];
|
||||
$cart_location = $values['event_cart_location'];
|
||||
$event_extra_service = $values['event_extra_service'];
|
||||
$ticket_type_arr = $values['event_ticket_info'];
|
||||
$product_id = $values['product_id'];
|
||||
$cart_location = $values['event_cart_location'];
|
||||
$event_extra_service = $values['event_extra_service'];
|
||||
$ticket_type_arr = $values['event_ticket_info'];
|
||||
|
||||
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
|
||||
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
|
||||
|
||||
if($form_position=='details_page'){
|
||||
$event_user_info = $values['event_user_info'];
|
||||
$event_user_info = $values['event_user_info'];
|
||||
}else{
|
||||
$event_user_info = mep_save_attendee_info_into_cart($eid);
|
||||
$event_user_info = mep_save_attendee_info_into_cart($eid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$item->add_meta_data('Date',$cart_date);
|
||||
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
if($recurring == 'yes'){
|
||||
$event_recurring_date = $values['event_recurring_date'];
|
||||
$event_recurring_date_arr = $values['event_recurring_date_arr'];
|
||||
if(is_array($event_recurring_date) && sizeof($event_recurring_date) > 0){
|
||||
foreach($event_recurring_date as $_event_recurring_date){
|
||||
$item->add_meta_data('Date',get_mep_datetime($_event_recurring_date, 'date-time-text'));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$event_recurring_date_arr = array();
|
||||
$item->add_meta_data('Date',get_mep_datetime($cart_date, 'date-time-text'));
|
||||
}
|
||||
$item->add_meta_data('_recurring_date_arr',$event_recurring_date_arr);
|
||||
$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 = 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(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $ticket){
|
||||
$ticket_type_name = $ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = ';
|
||||
$ticket_type_val= wc_price($ticket['ticket_price'] * $ticket['ticket_qty']);
|
||||
$item->add_meta_data($ticket_type_name, $ticket_type_val );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($event_extra_service) && sizeof($event_extra_service) > 0){
|
||||
foreach($event_extra_service as $extra_service){
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $ticket){
|
||||
$ticket_type_name = $ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = ';
|
||||
$ticket_type_val= wc_price($ticket['ticket_price'] * $ticket['ticket_qty']);
|
||||
$item->add_meta_data($ticket_type_name, $ticket_type_val );
|
||||
|
||||
$service_type_name = $extra_service['service_name']." - ".wc_price($extra_service['service_price']).' x '.$extra_service['service_qty'].' = ';
|
||||
$service_type_val= wc_price($extra_service['service_price'] * $extra_service['service_qty']);
|
||||
$item->add_meta_data($service_type_name, $service_type_val );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($event_extra_service) && sizeof($event_extra_service) > 0){
|
||||
foreach($event_extra_service as $extra_service){
|
||||
|
||||
$service_type_name = $extra_service['service_name']." - ".wc_price($extra_service['service_price']).' x '.$extra_service['service_qty'].' = ';
|
||||
$service_type_val= wc_price($extra_service['service_price'] * $extra_service['service_qty']);
|
||||
$item->add_meta_data($service_type_name, $service_type_val );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($event_ticket_type){
|
||||
|
|
|
@ -256,7 +256,7 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
$vegetarian = $_user_info['user_vegetarian'];
|
||||
$tshirtsize = $_user_info['user_tshirtsize'];
|
||||
$ticket_type = $_user_info['user_ticket_type'];
|
||||
$ticket_qty = $_user_info['user_ticket_qty'];
|
||||
$ticket_qty = $_user_info['user_ticket_qty'];
|
||||
$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'] : "";
|
||||
|
@ -313,11 +313,7 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
}
|
||||
|
||||
// add_action('admin_init','ttest');
|
||||
|
||||
function ttest(){
|
||||
mep_attendee_extra_service_create(11289,8938);
|
||||
}
|
||||
|
||||
|
||||
function mep_attendee_extra_service_create($order_id,$event_id){
|
||||
|
||||
|
@ -668,170 +664,7 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
|
||||
|
||||
// add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4);
|
||||
function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) {
|
||||
global $wpdb;
|
||||
|
||||
// Getting an instance of the order object
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_meta = get_post_meta($order_id);
|
||||
|
||||
$c = 1;
|
||||
# Iterating through each order items (WC_Order_Item_Product objects in WC 3+)
|
||||
foreach ( $order->get_items() as $item_id => $item_values ) {
|
||||
$item_quantity = $item_values->get_quantity();
|
||||
$item_id = $item_id;
|
||||
}
|
||||
$ordr_total = $order->get_total();
|
||||
$product_id = mep_event_get_order_meta($item_id,'_product_id');
|
||||
if($product_id==0){
|
||||
|
||||
$event_id = mep_event_get_order_meta($item_id,'event_id');
|
||||
|
||||
if (get_post_type($event_id) == 'mep_events') {
|
||||
|
||||
|
||||
$table_name = $wpdb->prefix . 'woocommerce_order_itemmeta';
|
||||
$result = $wpdb->get_results( "SELECT * FROM $table_name WHERE order_item_id=$item_id" );
|
||||
|
||||
|
||||
$mep_total = get_post_meta($event_id,'total_booking', true);
|
||||
if($mep_total){
|
||||
$mep_total_booking = $mep_total;
|
||||
}else{
|
||||
$mep_total_booking =0;
|
||||
}
|
||||
|
||||
|
||||
$email = $order_meta['_billing_email'][0];
|
||||
$order_meta_text = "_stock_msg_".$order_id;
|
||||
$order_processing = "processing_".$order_id;
|
||||
$order_completed = "completed_".$order_id;
|
||||
$order_cancelled = "cancelled_".$order_id;
|
||||
$mep_atnd = "_mep_atnd_".$order_id;
|
||||
|
||||
|
||||
// if($order->has_status( 'processing' ) || $order->has_status( 'pending' )) {
|
||||
if($order->has_status( 'processing' ) || $order->has_status( 'pending' )) {
|
||||
// update_post_meta( $event_id, $mep_atnd, "a2");
|
||||
|
||||
$mep_stock_msgc = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
|
||||
$mep_stock_orderc = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
|
||||
|
||||
if($mep_stock_orderc==$order_id){
|
||||
if($mep_stock_msgc=='cancelled'){
|
||||
|
||||
foreach ( $result as $page ){
|
||||
if (strpos($page->meta_key, '_') !== 0) {
|
||||
|
||||
$order_option_name = $event_id.str_replace(' ', '', mep_get_string_part($page->meta_key,0));
|
||||
|
||||
$order_option_qty = mep_get_string_part($page->meta_key,1);
|
||||
$tes = get_post_meta($event_id,"mep_xtra_$order_option_name",true);
|
||||
$ntes = ($tes+$order_option_qty);
|
||||
update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_post_meta( $event_id, $order_meta_text, $order_processing);
|
||||
|
||||
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
|
||||
$mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
|
||||
|
||||
|
||||
if($mep_stock_order==$order_id){
|
||||
if($mep_stock_msg=='completed'){
|
||||
update_post_meta( $event_id, $order_meta_text, $order_processing);
|
||||
}
|
||||
else{
|
||||
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
|
||||
update_post_meta( $event_id, $order_meta_text, $order_processing);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($order->has_status( 'cancelled' ) || $order->has_status( 'refunded' ) || $order->has_status( 'failed' )) {
|
||||
|
||||
update_post_meta( $event_id,$mep_atnd, "a2");
|
||||
update_post_meta( $event_id, $order_meta_text, $order_cancelled);
|
||||
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
|
||||
$mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
|
||||
|
||||
|
||||
if($mep_stock_order==$order_id){
|
||||
$update_total_booking = update_post_meta( $event_id, 'total_booking', ($mep_total_booking-$item_quantity));
|
||||
|
||||
foreach ( $result as $page ){
|
||||
if (strpos($page->meta_key, '_') !== 0) {
|
||||
$order_option_name = $event_id.str_replace(' ', '', mep_get_string_part($page->meta_key,0));
|
||||
$order_option_qty = mep_get_string_part($page->meta_key,1);
|
||||
$tes = get_post_meta($event_id,"mep_xtra_$order_option_name",true);
|
||||
$ntes = ($tes-$order_option_qty);
|
||||
if($tes>0){
|
||||
update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( $order->has_status( 'completed' )) {
|
||||
update_post_meta( $event_id, $mep_atnd, "a2");
|
||||
// update_post_meta( $event_id, $order_meta_text, $order_completed);
|
||||
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
|
||||
$mep_stock_order = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),1);
|
||||
// mep_event_confirmation_email_sent($event_id,$email);
|
||||
if($ordr_total==0){
|
||||
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
|
||||
}
|
||||
|
||||
if($mep_stock_order==$order_id){
|
||||
|
||||
if($mep_stock_msg=='processing'){
|
||||
update_post_meta( $event_id, $order_meta_text, $order_completed);
|
||||
}elseif($mep_stock_msg=='pending'){
|
||||
|
||||
if($ordr_total>0){
|
||||
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
|
||||
update_post_meta( $event_id, $order_meta_text, $order_completed);
|
||||
|
||||
// foreach ( $result as $page ){
|
||||
// if (strpos($page->meta_key, '_') !== 0) {
|
||||
// $order_option_name = $event_id.str_replace(' ', '', mep_get_string_part($page->meta_key,0));
|
||||
// $order_option_qty = mep_get_string_part($page->meta_key,1);
|
||||
// $tes = get_post_meta($event_id,"mep_xtra_$order_option_name",true);
|
||||
// $ntes = ($tes+$order_option_qty);
|
||||
// update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
// update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
|
||||
update_post_meta( $event_id, $order_meta_text, $order_completed);
|
||||
|
||||
foreach ( $result as $page ){
|
||||
if (strpos($page->meta_key, '_') !== 0) {
|
||||
$order_option_name = $event_id.str_replace(' ', '', mep_get_string_part($page->meta_key,0));
|
||||
$order_option_qty = mep_get_string_part($page->meta_key,1);
|
||||
$tes = get_post_meta($event_id,"mep_xtra_$order_option_name",true);
|
||||
$ntes = ($tes+$order_option_qty);
|
||||
update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1010,19 +843,12 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
add_action('init','mep_include_template_parts');
|
||||
function mep_include_template_parts(){
|
||||
// $template_name = 'templating.php';
|
||||
// $template_path = get_stylesheet_directory().'/mage-events/template-prts/';
|
||||
// if(file_exists($template_path . $template_name)) {
|
||||
// require_once(get_stylesheet_directory() . "/mage-events/template-prts/templating.php");
|
||||
// }else{
|
||||
// require_once(dirname(__FILE__) . "/inc/template-prts/templating.php");
|
||||
// }
|
||||
require_once(dirname(__DIR__) . "/inc/template-prts/templating.php");
|
||||
}
|
||||
|
||||
|
||||
function mep_load_events_templates($template) {
|
||||
global $post;
|
||||
global $post;
|
||||
if ($post->post_type == "mep_events"){
|
||||
$template_name = 'single-events.php';
|
||||
$template_path = 'mage-events/';
|
||||
|
@ -1272,8 +1098,8 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
echo $content;
|
||||
}
|
||||
|
||||
// event_template_name();
|
||||
function event_template_name(){
|
||||
// mep_event_template_name();
|
||||
function mep_event_template_name(){
|
||||
|
||||
$template_name = 'index.php';
|
||||
$template_path = get_stylesheet_directory().'/mage-events/themes/';
|
||||
|
@ -1308,7 +1134,7 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
|
||||
function event_single_template_list($current_theme){
|
||||
$themes = event_template_name();
|
||||
$themes = mep_event_template_name();
|
||||
$buffer = '<select name="mep_event_template">';
|
||||
foreach ($themes as $num=>$desc){
|
||||
if($current_theme==$num){ $cc = 'selected'; }else{ $cc = ''; }
|
||||
|
@ -1587,18 +1413,18 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
function get_single_date_time( $start_datetime, $end_datetime ) {
|
||||
|
||||
$date_format = get_option( 'date_format' );
|
||||
$time_format = get_option( 'time_format' );
|
||||
$wpdatesettings = $date_format.$time_format;
|
||||
$date_format = get_option( 'date_format' );
|
||||
$time_format = get_option( 'time_format' );
|
||||
$wpdatesettings = $date_format.$time_format;
|
||||
|
||||
$start_date = date_i18n( $date_format, strtotime( $start_datetime ) );
|
||||
$end_date = date_i18n( $date_format, strtotime( $end_datetime ) );
|
||||
$start_date = date_i18n( $date_format, strtotime( $start_datetime ) );
|
||||
$end_date = date_i18n( $date_format, strtotime( $end_datetime ) );
|
||||
|
||||
$nameOfDay = date_i18n( $date_format, strtotime( $start_date ) );
|
||||
$nameOfDayEnd = date_i18n( $date_format, strtotime( $end_date ) );
|
||||
$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 ) );
|
||||
$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;
|
||||
|
@ -1774,22 +1600,14 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
$mep_event_id = $_POST['mep_event_id'];
|
||||
}else{ $mep_event_id=""; }
|
||||
|
||||
|
||||
|
||||
if ( isset( $_POST['option_qty'] ) ) {
|
||||
$mep_user_option_qty = $_POST['option_qty'];
|
||||
} else {
|
||||
$mep_user_option_qty = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// print_r($event_date);
|
||||
// die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['mep_ucf'])){
|
||||
|
@ -2061,35 +1879,34 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
$args = array(
|
||||
'post_type' => 'mep_events_attendees',
|
||||
'posts_per_page' => -1,
|
||||
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => 'ea_event_id',
|
||||
'value' => $event_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_ticket_type',
|
||||
'value' => $type,
|
||||
'compare' => '='
|
||||
)
|
||||
),array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'ea_order_status',
|
||||
'value' => 'processing',
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_order_status',
|
||||
'value' => 'completed',
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
)
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => 'ea_event_id',
|
||||
'value' => $event_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_ticket_type',
|
||||
'value' => $type,
|
||||
'compare' => '='
|
||||
)
|
||||
),array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'ea_order_status',
|
||||
'value' => 'processing',
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_order_status',
|
||||
'value' => 'completed',
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
$loop = new WP_Query($args);
|
||||
|
@ -2264,12 +2081,12 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
function mep_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_name' => uniqid(),
|
||||
'post_category' => array(), // Usable for custom taxonomies too
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
|
||||
|
@ -2352,6 +2169,7 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
$my_post = array(
|
||||
'ID' => $product_id,
|
||||
'post_title' => $event_name, // new title
|
||||
'post_name' => uniqid()// do your thing here
|
||||
);
|
||||
|
||||
// unhook this function so it doesn't loop infinitely
|
||||
|
@ -2371,8 +2189,8 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
|
||||
|
||||
add_action('parse_query', 'product_tags_sorting_query');
|
||||
function product_tags_sorting_query($query) {
|
||||
add_action('parse_query', 'mep_product_tags_sorting_query');
|
||||
function mep_product_tags_sorting_query($query) {
|
||||
global $pagenow;
|
||||
|
||||
$taxonomy = 'product_visibility';
|
||||
|
@ -2524,8 +2342,8 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
|
||||
add_filter('woocommerce_cart_item_price', 'mep_avada_mini_cart_price_fixed', 100, 3);
|
||||
function mep_avada_mini_cart_price_fixed($price,$cart_item,$r){
|
||||
$price = wc_price($cart_item['line_total']);
|
||||
return $price;
|
||||
$price = wc_price($cart_item['line_total']);
|
||||
return $price;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2540,4 +2358,9 @@ function mep_get_all_tax_list($current_tax=null){
|
|||
return $string;
|
||||
}
|
||||
return strip_tags($string, $allowed_tags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_filter('wpseo_premium_post_redirect_slug_change', '__return_true' );
|
||||
add_filter('wpseo_premium_term_redirect_slug_change', '__return_true' );
|
||||
add_filter('wpseo_enable_notification_term_slug_change','__return_false');
|
|
@ -297,6 +297,7 @@ function mep_create_hidden_event_product($post_id,$title){
|
|||
$new_post = array(
|
||||
'post_title' => $title,
|
||||
'post_content' => '',
|
||||
'post_name' => uniqid(),
|
||||
'post_category' => array(),
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish',
|
||||
|
|
|
@ -25,9 +25,9 @@ function mep_ev_ticket_type(){
|
|||
<?php
|
||||
$count =1;
|
||||
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;
|
||||
$default_qty = isset($field['option_default_qty_t']) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0;
|
||||
$qty_t_type = $field['option_qty_t_type'];
|
||||
$total_quantity = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
|
||||
$default_qty = isset($field['option_default_qty_t']) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0;
|
||||
$total_resv_quantity = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
|
||||
$event_date = get_post_meta($post->ID, 'event_start_date', true).' '.get_post_meta($post->ID, 'event_start_time', true);
|
||||
$total_sold = (int) mep_ticket_type_sold(get_the_id(),$field['option_name_t'],$event_date);
|
||||
|
@ -35,7 +35,9 @@ function mep_ev_ticket_type(){
|
|||
$total_seats = apply_filters('mep_total_ticket_of_type',$total_tickets,get_the_id(),$field);
|
||||
$total_min_seat = apply_filters('mep_ticket_min_qty',0,get_the_id(),$field);
|
||||
$default_quantity = apply_filters('mep_ticket_default_qty',$default_qty,get_the_id(),$field);
|
||||
$total_left = $total_tickets;
|
||||
$total_left = apply_filters('mep_total_ticket_of_type',$total_tickets,get_the_id(),$field);
|
||||
// $total_left = $total_tickets;
|
||||
$passed = apply_filters('mep_ticket_type_validation',true);
|
||||
?>
|
||||
<tr>
|
||||
<td align="Left"><?php echo $field['option_name_t']; ?>
|
||||
|
@ -55,26 +57,26 @@ function mep_ev_ticket_type(){
|
|||
if($qty_t_type=='dropdown'){ ?>
|
||||
<select name="option_qty[]" id="eventpxtp_<?php echo $count; ?>" <?php if($total_left<=0){ ?> style='display: none!important;' <?php } ?> class='extra-qty-box etp'>
|
||||
<?php
|
||||
if (is_plugin_active('woocommerce-event-manager-min-max-quantity-addon/mep_min_max_qty.php')){
|
||||
do_action('min_max_data_execute', $field, $total_left, $pid, get_current_user_id());
|
||||
}else{
|
||||
for ($i = $total_min_seat; $i <= $total_left; $i++) { ?>
|
||||
<option value="<?php echo $i; ?>" <?php if($i == $default_quantity){ echo 'Selected'; } ?>><?php echo $i; ?>
|
||||
<?php echo mep_get_option('mep_ticket_text', 'label_setting_sec') ? mep_get_option('mep_ticket_text', 'label_setting_sec') : _e('Ticket:','mage-eventpress'); ?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php }else{ ?>
|
||||
<?php if (is_plugin_active('woocommerce-event-manager-min-max-quantity-addon/mep_min_max_qty.php')){
|
||||
do_action('min_max_data_number_type', $field, $total_left, $pid, get_current_user_id(), $count);
|
||||
}else{ ?>
|
||||
|
||||
<div class="mage_input_group">
|
||||
<span class="fa fa-minus qty_dec"></span>
|
||||
<!--input id="eventpxtp_<?php echo $count; ?>" <?php //if($ext_left<=0){ echo "disabled"; } ?> type="text" class='extra-qty-box etp' name='option_qty[]' data-price='<?php echo $field['option_price_t']; ?>' value='<?php echo $default_quantity; ?>' min="<?php echo $default_quantity; ?>" max="<?php echo max($total_left,0); ?>"-->
|
||||
<input id="eventpxtp_<?php echo $count; ?>" <?php //if($ext_left<=0){ echo "disabled"; } ?> type="text" class='extra-qty-box etp' name='option_qty[]' data-price='<?php echo $field['option_price_t']; ?>' value='<?php echo $default_quantity; ?>' min="<?php echo $total_min_seat; ?>" max="<?php echo max($total_seats,0); ?>">
|
||||
<span class="fa fa-plus qty_inc"></span>
|
||||
</div>
|
||||
<?php }} }else{ _e('No Seat Available','mage-eventpress'); } ?>
|
||||
<?php } }else{ _e('No Seat Available','mage-eventpress'); }
|
||||
$ticket_name = $field['option_name_t'];
|
||||
do_action('mep_after_ticket_type_qty',get_the_id(),$ticket_name,$field,$default_quantity);
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<td class="ticket-price"><span class="tkt-pric">
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue