Required Tour variation

  • Member
    June 11, 2020 at 3:10 pm #10692

    I am using your plugin to manage tours on our website.
    I added some variations to a tour and made them required.

    The problem is when I submit the booking form, 2 situations are possible :
    1/If I don’t add an input to the required variation, I get an error
    2/If I add an input to the required variation, nothing happens.

    My problem is with the second situation. When I inspected and tried to debug the code, I found out that there is a loop that doesn’t stop when it gets the value of the required variation.

    Here is the code that loops for the variation

    $.each(el_variation_attr_field, function (i) {
    								console.log("*************start iteration*****"); 
    								console.log('value of i '+ i);
    								let el_variation_attr_field = $(this);
    								variation_attr_id = parseInt(el_variation_attr_field.attr('name'));
    								console.log("attribute value "+ el_variation_attr_field.val() ) ;
    								if (parseFloat(el_variation_attr_field.val()) > 0) {
    									console.log("field > 0") ; 
    									data.tour_variations[variation_id][variation_attr_id] = {};
    									data.tour_variations[variation_id][variation_attr_id].quantity = el_variation_attr_field.val();
    									flag_error_variation_quantity = false;
    									console.log('*******value of flag_error_quantity'+flag_error_variation_quantity);
    								console.log("total variation "+ total_el_variation_attr_field ) ; 
    								if (variation_required) {
    									if (flag_error_variation_quantity && i === total_el_variation_attr_field - 1) {
    										flag_errors = true;
    										setTimeout(function () {
    										}, 2000);
    									else flag_errors = false;

    Can you please help me figure this out ?
    Thank you for your help

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.