fixed jquery quantity calculation issue

This commit is contained in:
magepeopleteam 2018-12-20 05:56:29 +00:00
parent 13efd5e671
commit 3ee5098d48
4 changed files with 19 additions and 33 deletions

View File

@ -11,7 +11,7 @@ if(isset($_POST['event_addt_price'])){
if(isset($_POST['option_name'])){
$names = $_POST['option_name'];
}else{ $names=""; }
}else{ $names=array(); }
if(isset($_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);
if ( $mep_form_builder_data ) {
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] ) );
endif;
}
}
@ -183,11 +181,9 @@ if(isset($_POST['mep_event_ticket_type'])){
$cart_item_data['line_subtotal'] = $tp;
$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', 10, 3);
@ -210,6 +206,7 @@ if (get_post_type($eid) == 'mep_events') {
function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
$mep_events_extra_prices = $cart_item['event_extra_option'];
// print_r($cart_item);
if($mep_events_extra_prices){
echo "<ul class='event-custom-price'>";

View File

@ -111,6 +111,7 @@ jQuery(".extra-qty-box").on('change', function() {
sum = (price.html() * count.val());
total = total + sum;
// price.closest('tr').find('.cart_total_price').html(sum + "₴");
});
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
<?php
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
if($mep_event_ticket_type){
@ -133,7 +131,7 @@ jQuery('.btn-mep-event-cart').hide();
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 input = parseInt(inputs);
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'); ?>")
);
}
});
<?php
$count++;
}

View File

@ -9,7 +9,6 @@ global $post,$event_meta;
$event_meta = get_post_custom($post_id);
$event_expire_date = $event_meta['mep_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]);
@ -50,7 +49,6 @@ if($mep_event_ticket_type){
}else{
$seat_left = $seat_left;
}
if(time() > strtotime($newformat)){
?>
<span class=event-expire-btn>
@ -73,22 +71,11 @@ else{
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 = '';
}
// echo $reg_status;
if($reg_status!='off'){
?>
<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'); ?>
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
<table>
<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);
// print_r($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">
<span id="ttyttl"></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'>
@ -116,7 +103,16 @@ if($qty_typec=='dropdown'){ ?>
</select>
<?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">
<?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>
</tr>
</table>

View File

@ -3,14 +3,13 @@
* Plugin Name: Woocommerce Events Manager
* Plugin URI: http://mage-people.com
* Description: A Complete Event Solution for WordPress by MagePeople..
* Version: 2.2.6
* Version: 2.2.7
* Author: MagePeople Team
* Author URI: http://www.mage-people.com/
* Text Domain: mage-eventpress
* Domain Path: /languages/
*/
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
require_once(dirname(__FILE__) . "/inc/class/mep_settings_api.php");
require_once(dirname(__FILE__) . "/inc/mep_cpt.php");