new feature quantity box added in this version

This commit is contained in:
magepeopleteam 2018-02-15 12:00:25 +00:00
parent c2361ac506
commit 8e8513d6d3
4 changed files with 180 additions and 29 deletions

View File

@ -304,7 +304,16 @@ html body .mep_event_list .mep_list_event_details a {
margin: 0 0 10px 0 !important;
}
#quantity_5a7abbd1bff73 {
width: 60px;
}
.qty-ttl {
/* float: left; */
overflow: hidden;
display: block;
width: 100%;
text-align: left;
}
/* Responsive CSS

View File

@ -73,6 +73,12 @@ function mep_event_price_meta_box_cb($post){
$values = get_post_custom( $post->ID );
?>
<div class='sec'>
<label for="mep_ev_98"> Show Quantity Input Box: </label>
<span><input style='text-align: left;width: auto;' id='mep_ev_98' type="checkbox" name='mep_sqi' value='1' <?php $sqi = $values['mep_sqi'][0]; if($sqi==1){ echo 'checked'; } ?> > Yes</span>
</div>
<div class='sec'>
<label for="mep_ev_8"> Price Label: </label>
<span><input id='mep_ev_8' type="text" name='mep_price_label' value='<?php echo $values['mep_price_label'][0]; ?>'> </span>
@ -123,30 +129,38 @@ function mep_events_meta_save($post_id){
return;
}
//if you get here then it's your post type so do your thing....
$seat = strip_tags($_POST['mep_total_seat']);
$mep_location_venue = strip_tags($_POST['mep_location_venue']);
$mep_street = strip_tags($_POST['mep_street']);
$mep_city = strip_tags($_POST['mep_city']);
$mep_state = strip_tags($_POST['mep_state']);
$mep_postcode = strip_tags($_POST['mep_postcode']);
$mep_country = strip_tags($_POST['mep_country']);
$mep_price_label = strip_tags($_POST['mep_price_label']);
$_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']);
$seat = strip_tags($_POST['mep_total_seat']);
$mep_location_venue = strip_tags($_POST['mep_location_venue']);
$mep_street = strip_tags($_POST['mep_street']);
$mep_city = strip_tags($_POST['mep_city']);
$mep_state = strip_tags($_POST['mep_state']);
$mep_postcode = strip_tags($_POST['mep_postcode']);
$mep_country = strip_tags($_POST['mep_country']);
$mep_price_label = strip_tags($_POST['mep_price_label']);
$mep_sqi = strip_tags($_POST['mep_sqi']);
$_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']);
$update_seat = update_post_meta( $pid, 'mep_total_seat', $seat);
$update_location = update_post_meta( $pid, 'mep_location_venue', $mep_location_venue);
$update_seat = update_post_meta( $pid, 'mep_total_seat', $seat);
$update_seat_stock_status = update_post_meta( $pid, '_manage_stock', 'yes');
$update_seat_stock = update_post_meta( $pid, '_stock', $seat);
$sts_msg = update_post_meta( $pid, '_stock_msg', 'new');
// $ttl_booking = update_post_meta( $pid, 'total_booking', '0');
$update_location = update_post_meta( $pid, 'mep_location_venue', $mep_location_venue);
$update_mep_street = update_post_meta( $pid, 'mep_street', $mep_street);
$update_city = update_post_meta( $pid, 'mep_city', $mep_city);
$update_city = update_post_meta( $pid, 'mep_city', $mep_city);
$update_mep_state = update_post_meta( $pid, 'mep_state', $mep_state);
$update_postcode = update_post_meta( $pid, 'mep_postcode', $mep_postcode);
$update_conuntry = update_post_meta( $pid, 'mep_country', $mep_country);
$update_postcode = update_post_meta( $pid, 'mep_postcode', $mep_postcode);
$update_conuntry = update_post_meta( $pid, 'mep_country', $mep_country);
$update_sqi = update_post_meta( $pid, 'mep_sqi', $mep_sqi);
$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_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
$update_price = update_post_meta( $pid, '_price', $_price);
$update_start = update_post_meta( $pid, 'mep_event_start_date', $mep_event_start_date);
$update_end = update_post_meta( $pid, 'mep_event_end_date', $mep_event_end_date);
}

View File

@ -21,10 +21,22 @@ Features:
* Open Source
* Responsive Design
* Developer Friendly
* Woocommerce Ready
* Based on Woo-commerce
* Works with any standards compliant WordPress theme
* Plays well with other Plugins
* 100% Customizable
* Easy to modify templates
* Use Shortcode [event-list] for showing all faq question. if you want to show a event list of any particular category use [event-list cat=ID].
* Live demo http://demo.wp-people.net/mage-woo-event-booking-manager-free/
== Installation ==
Upload the Mage FAQ plugin to your blog, Activate it, then use shortcode as your need).

View File

@ -3,7 +3,7 @@
* Plugin Name: Mage Woo Event Booking Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 1.0
* Version: 1.0.1
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
*/
@ -173,18 +173,19 @@ function mep_set_event_attendee_data( $order_id ) {
$order_meta = get_post_meta($order_id);
# Iterating through each order items (WC_Order_Item_Product objects in WC 3+)
foreach ( $order->get_items() as $item_id => $item_values ) {
$product_id = $item_values->get_product_id();
$item_data = $item_values->get_data();
$product_id = $item_data['product_id'];
$item_quantity = $item_values->get_quantity();
$product = get_page_by_title( $item_data['name'], OBJECT, 'mep_events' );
$event_name = $item_data['name'];
$event_id = $product->ID;
}
$first_name = $order_meta['_billing_first_name'][0];
$last_name = $order_meta['_billing_last_name'][0];
$company_name = $order_meta['_billing_company'][0];
@ -209,7 +210,7 @@ function mep_set_event_attendee_data( $order_id ) {
'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
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
@ -230,14 +231,110 @@ function mep_set_event_attendee_data( $order_id ) {
$update_eid = update_post_meta( $pid, 'ea_event_id', $event_id);
$update_oid = update_post_meta( $pid, 'ea_order_id', $order_id);
$mep_total_booking = get_post_meta($event_id,'total_booking', true);
$update_total_booking = update_post_meta( $event_id, 'total_booking', ($mep_total_booking+1));
}
}
function mep_get_order_info($info,$id){
$stock_msg = $info;
$koba = explode("_", $stock_msg);
return $koba[$id];
}
add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4);
function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) {
// Getting an instance of the order object
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
# Iterating through each order items (WC_Order_Item_Product objects in WC 3+)
foreach ( $order->get_items() as $item_id => $item_values ) {
$product_id = $item_values->get_product_id();
$item_data = $item_values->get_data();
$product_id = $item_data['product_id'];
$item_quantity = $item_values->get_quantity();
$product = get_page_by_title( $item_data['name'], OBJECT, 'mep_events' );
$event_name = $item_data['name'];
$event_id = $product->ID;
}
$mep_total = get_post_meta($event_id,'total_booking', true);
if($mep_total){
$mep_total_booking = $mep_total;
}else{
$mep_total_booking =0;
}
$order_meta_text = "_stock_msg_".$order_id;
$order_processing = "processing_".$order_id;
$order_completed = "completed_".$order_id;
$order_cancelled = "cancelled_".$order_id;
if( $order->has_status( 'processing' )) {
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' )) {
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));
}
}
if( $order->has_status( 'completed' )) {
// update_post_meta( $event_id, $order_meta_text, $order_completed);
$mep_stock_msg = mep_get_order_info(get_post_meta($event_id,$order_meta_text, true),0);
$mep_stock_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=='processing'){
update_post_meta( $event_id, $order_meta_text, $order_completed);
}
else{
update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity));
update_post_meta( $event_id, $order_meta_text, $order_completed);
}
}
}
}
add_action('restrict_manage_posts', 'mep_filter_post_type_by_taxonomy');
function mep_filter_post_type_by_taxonomy() {
@ -362,16 +459,25 @@ function mep_get_event_status($startdatetime){
// Get Event Registration Button
function mep_get_event_reg_btn($post_id){
// $event_meta = get_post_meta($post_id, 'mep_event_meta',true);
$event_meta = get_post_custom(get_the_id());
$event_expire_date = $event_meta['mep_event_start_date'][0];
$event_sqi = $event_meta['mep_sqi'][0];
$event_ecternal_link = '';
// $event_ecternal_url = $event_meta['ex_reg_url'][0];
$book_count = get_post_meta($post_id,'total_booking', true);
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
$seat_left = ($event_meta['mep_total_seat'][0]- $total_book);
$time = strtotime($event_expire_date);
$newformat = date('Y-m-d H:i:s',$time);
$datetime1 = new DateTime();
@ -381,6 +487,9 @@ $event_ecternal_link = '';
if(time() > strtotime($newformat)){
echo "<span class=event-expire-btn>Event Expired</span>";
}
elseif($seat_left<=0){
echo "<span class=event-expire-btn>No Seat Available</span>";
}
else{
$days = $interval->d;
$hours = $interval->h;
@ -392,7 +501,14 @@ $event_ecternal_link = '';
?>
<form action="" method='post'>
<?php //do_action('event_kaku_before_reg_btn'); ?>
<?php //do_action('event_kaku_before_reg_btn'); ?>
<?php if($event_sqi==1){ ?>
<label for="quantity_5a7abbd1bff73" class='qty-ttl'><?php _e('Total'); ?> <input id="quantity_5a7abbd1bff73" class="input-text qty text" 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"></label>
<?php } ?>
<span id="usertotal"> </span>
<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">Register This Event </button>
</form>