fixed jquery quantity calculation issue
This commit is contained in:
parent
13efd5e671
commit
3ee5098d48
|
@ -11,7 +11,7 @@ if(isset($_POST['event_addt_price'])){
|
||||||
|
|
||||||
if(isset($_POST['option_name'])){
|
if(isset($_POST['option_name'])){
|
||||||
$names = $_POST['option_name'];
|
$names = $_POST['option_name'];
|
||||||
}else{ $names=""; }
|
}else{ $names=array(); }
|
||||||
|
|
||||||
if(isset($_POST['option_qty'])){
|
if(isset($_POST['option_qty'])){
|
||||||
$qty = $_POST['option_qty'];
|
$qty = $_POST['option_qty'];
|
||||||
|
@ -151,9 +151,7 @@ if(isset($_POST['mep_ucf'])){
|
||||||
$mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true);
|
$mep_form_builder_data = get_post_meta($product_id, 'mep_form_builder_data', true);
|
||||||
if ( $mep_form_builder_data ) {
|
if ( $mep_form_builder_data ) {
|
||||||
foreach ( $mep_form_builder_data as $_field ) {
|
foreach ( $mep_form_builder_data as $_field ) {
|
||||||
if ( $mep_user_ticket_type[$iu] != '' ) :
|
|
||||||
$user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) );
|
$user[$iu][$_field['mep_fbc_id']] = stripslashes( strip_tags( $_POST[$_field['mep_fbc_id']][$iu] ) );
|
||||||
endif;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,11 +181,9 @@ if(isset($_POST['mep_event_ticket_type'])){
|
||||||
$cart_item_data['line_subtotal'] = $tp;
|
$cart_item_data['line_subtotal'] = $tp;
|
||||||
$cart_item_data['event_id'] = $product_id;
|
$cart_item_data['event_id'] = $product_id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $cart_item_data;
|
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', 10, 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,6 +206,7 @@ if (get_post_type($eid) == 'mep_events') {
|
||||||
|
|
||||||
function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
|
function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
|
||||||
$mep_events_extra_prices = $cart_item['event_extra_option'];
|
$mep_events_extra_prices = $cart_item['event_extra_option'];
|
||||||
|
// print_r($cart_item);
|
||||||
if($mep_events_extra_prices){
|
if($mep_events_extra_prices){
|
||||||
echo "<ul class='event-custom-price'>";
|
echo "<ul class='event-custom-price'>";
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ jQuery(".extra-qty-box").on('change', function() {
|
||||||
sum = (price.html() * count.val());
|
sum = (price.html() * count.val());
|
||||||
total = total + sum;
|
total = total + sum;
|
||||||
// price.closest('tr').find('.cart_total_price').html(sum + "₴");
|
// price.closest('tr').find('.cart_total_price').html(sum + "₴");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery('#usertotal').html("<?php echo get_woocommerce_currency_symbol(); ?>" + total);
|
jQuery('#usertotal').html("<?php echo get_woocommerce_currency_symbol(); ?>" + total);
|
||||||
|
@ -118,9 +119,6 @@ jQuery(".extra-qty-box").on('change', function() {
|
||||||
|
|
||||||
}).change(); //trigger change event on page load
|
}).change(); //trigger change event on page load
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
|
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
|
||||||
if($mep_event_ticket_type){
|
if($mep_event_ticket_type){
|
||||||
|
@ -133,7 +131,7 @@ jQuery('.btn-mep-event-cart').hide();
|
||||||
|
|
||||||
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
|
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
|
||||||
|
|
||||||
// var inputs = jQuery("#ttyttl").html() || 0;
|
var inputs = jQuery("#ttyttl").html() || 0;
|
||||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||||
var input = parseInt(inputs);
|
var input = parseInt(inputs);
|
||||||
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').size() || 0;
|
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').size() || 0;
|
||||||
|
@ -155,11 +153,7 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
|
||||||
.html("<?php do_action('mep_reg_fields'); ?>")
|
.html("<?php do_action('mep_reg_fields'); ?>")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ global $post,$event_meta;
|
||||||
$event_meta = get_post_custom($post_id);
|
$event_meta = get_post_custom($post_id);
|
||||||
$event_expire_date = $event_meta['mep_event_start_date'][0];
|
$event_expire_date = $event_meta['mep_event_start_date'][0];
|
||||||
$event_sqi = $event_meta['mep_sqi'][0];
|
$event_sqi = $event_meta['mep_sqi'][0];
|
||||||
|
|
||||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][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_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||||
|
@ -50,7 +49,6 @@ if($mep_event_ticket_type){
|
||||||
}else{
|
}else{
|
||||||
$seat_left = $seat_left;
|
$seat_left = $seat_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(time() > strtotime($newformat)){
|
if(time() > strtotime($newformat)){
|
||||||
?>
|
?>
|
||||||
<span class=event-expire-btn>
|
<span class=event-expire-btn>
|
||||||
|
@ -73,22 +71,11 @@ else{
|
||||||
if($hours>0){ $hh = $hours." hours "; }else{ $hh=""; }
|
if($hours>0){ $hh = $hours." hours "; }else{ $hh=""; }
|
||||||
if($minutes>0){ $mm = $minutes." minutes "; }else{ $mm=""; }
|
if($minutes>0){ $mm = $minutes." minutes "; }else{ $mm=""; }
|
||||||
$qty_typec = $event_meta['qty_box_type'][0];
|
$qty_typec = $event_meta['qty_box_type'][0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(array_key_exists('mep_reg_status', $event_meta)){
|
if(array_key_exists('mep_reg_status', $event_meta)){
|
||||||
$reg_status = $event_meta['mep_reg_status'][0];
|
$reg_status = $event_meta['mep_reg_status'][0];
|
||||||
}else{
|
}else{
|
||||||
$reg_status = '';
|
$reg_status = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// echo $reg_status;
|
|
||||||
|
|
||||||
|
|
||||||
if($reg_status!='off'){
|
if($reg_status!='off'){
|
||||||
?>
|
?>
|
||||||
<h4 class="mep-cart-table-title"> <?php _e('Register Now:','mage-eventpress'); ?></h4>
|
<h4 class="mep-cart-table-title"> <?php _e('Register Now:','mage-eventpress'); ?></h4>
|
||||||
|
@ -96,17 +83,17 @@ if($reg_status!='off'){
|
||||||
<?php do_action('mep_event_ticket_type_extra_service'); ?>
|
<?php do_action('mep_event_ticket_type_extra_service'); ?>
|
||||||
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
|
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
|
||||||
<table>
|
<table>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" class='total-col'><?php _e('Quantity:','mage-eventpress'); ?> <?php if($event_sqi==1){
|
<td align="left" class='total-col'><?php _e('Quantity:','mage-eventpress');
|
||||||
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true);
|
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true);
|
||||||
|
// print_r($mep_event_ticket_type);
|
||||||
if($mep_event_ticket_type){
|
if($mep_event_ticket_type){
|
||||||
?>
|
?>
|
||||||
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
|
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($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"></span>
|
<span id="ttyttl"></span>
|
||||||
<?php
|
<?php
|
||||||
}else{
|
}else{
|
||||||
|
if($event_sqi==1){
|
||||||
$qmx = ($event_meta['mep_total_seat'][0]- $total_book);
|
$qmx = ($event_meta['mep_total_seat'][0]- $total_book);
|
||||||
if($qty_typec=='dropdown'){ ?>
|
if($qty_typec=='dropdown'){ ?>
|
||||||
<select name="quantity" id="quantity_5a7abbd1bff73" class='input-text qty text extra-qty-box'>
|
<select name="quantity" id="quantity_5a7abbd1bff73" class='input-text qty text extra-qty-box'>
|
||||||
|
@ -116,7 +103,16 @@ if($qty_typec=='dropdown'){ ?>
|
||||||
</select>
|
</select>
|
||||||
<?php }else{ ?>
|
<?php }else{ ?>
|
||||||
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="number">
|
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($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; } ?> <span class='the-total'><?php _e('Total','mage-eventpress'); ?> <span id="usertotal"></span></span></td>
|
<?php
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
echo 1;
|
||||||
|
?>
|
||||||
|
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo ($event_meta['mep_total_seat'][0]- $total_book); ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?> <span class='the-total'><?php _e('Total','mage-eventpress'); ?> <span id="usertotal"></span></span></td>
|
||||||
<td align="right"> <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></td>
|
<td align="right"> <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></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
* Plugin Name: Woocommerce Events Manager
|
* Plugin Name: Woocommerce Events Manager
|
||||||
* Plugin URI: http://mage-people.com
|
* Plugin URI: http://mage-people.com
|
||||||
* Description: A Complete Event Solution for WordPress by MagePeople..
|
* Description: A Complete Event Solution for WordPress by MagePeople..
|
||||||
* Version: 2.2.6
|
* Version: 2.2.7
|
||||||
* Author: MagePeople Team
|
* Author: MagePeople Team
|
||||||
* Author URI: http://www.mage-people.com/
|
* Author URI: http://www.mage-people.com/
|
||||||
* Text Domain: mage-eventpress
|
* Text Domain: mage-eventpress
|
||||||
* Domain Path: /languages/
|
* Domain Path: /languages/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
||||||
require_once(dirname(__FILE__) . "/inc/class/mep_settings_api.php");
|
require_once(dirname(__FILE__) . "/inc/class/mep_settings_api.php");
|
||||||
require_once(dirname(__FILE__) . "/inc/mep_cpt.php");
|
require_once(dirname(__FILE__) . "/inc/mep_cpt.php");
|
||||||
|
|
Loading…
Reference in New Issue