• Resolved chochochocosensei

    (@chochochocosensei)


    I did a system update and some other updates, and suddenly EME is not producing any output, i.e. booking recorded message. By that I mean that when I sign up for an event, I am returned to the same page (fields wiped, new captcha) with no message of any kind — if it is there, it is being rewritten…. I dont know how to diagnose it. I have Show RSVP form again after booking? set to NO, but it is staying on that page…

    I tried disabling the captcha, but no change.

    here is my registration form:

    <br />
    <h1>Family Profile</h1>
    <table class="eme-rsvp-form alignleft" style="width:100%;">
    <tbody>
    <tr><th>[member_only]Email: [/member_only]</th><td>[snuser_email]</td>
    </tr>
    <tr><th>[member_only]Parent's name:[/member_only]</th><td>[snuser_firstname]</td>
    </tr>
    <tr><th>[member_only]Children's Names/Ages:[/member_only]</th><td>[user_lastname]</td>
    </tr>
    <tr>
    <th style="text-align: center;" colspan="2" scope="row">To change this information, <a href="https://chocochoco.byethost4.com/wp/pm_profile/">change your profile</a>.</td>
    </tr>
    </tbody>
    </table>
    
    <p style="text-align: left;">If are already reserved for this event, it will appear below:</p>
    <div>[eme_mybookings id=#_EVENTID template_id=7 template_id_footer=8]</div>
    
    <h1>Register for the event</h1>
    <span style="display:none;" > #_NAME, #_EMAIL</span>
    <table class="eme-rsvp-form alignleft" style="width:100%;">
    <tbody>
    <tr>
    <th style="text-align: right;" scope="row">How many children under 3? *</th>
    <td>#_SEATS{1}</td>
    </tr>
    <tr>
    <th style="text-align: right;" scope="row">How many children 3 or over? *</th>
    <td>#_SEATS{2}</td>
    </tr>
    <tr>
    <th style="text-align: right;" scope="row">Comments, Questions, Suggestions</th>
    <td style="vertical-align:middle">#_COMMENT</td>
    </tr>
    <tr><th scope='row'>Please fill in the code displayed here:</th><td>#_CAPTCHA</td></tr>
    <tr>
    <th style="text-align: center;" colspan="2" scope="row">#_SUBMIT</th>
    </tr>
    </tbody>
    </table>

    As a test I am using only a simple booking

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter chochochocosensei

    (@chochochocosensei)

    js from being deferred…I think this may have been messing things up. Will test.

    Thread Starter chochochocosensei

    (@chochochocosensei)

    Perhaps I should post this as a separate thread, but after testing this is what I have:

    Even with the cache plugins disabled entirely I get all of the following errors:

    1. impossible to turn on wp_debug

    2. creating the filter function my_eme_discount_function($booking) (you gave me) above no longer works. Inserting pretty much any line in the function that accesses a variable or computation (if, print_r, $var) gets a BR message upon booking:
    an error has occurred
    (even though the booking may go through). Even if no message is shown (echo), as with the example I gave above, the discount is not applied.
    If an error is shown, the following js error (e.g.) is thrown:

    jquery.js?ver=1.12.4:4 POST ...wp/en/events/120/test-copy/ 500 ()
    send @ jquery.js?ver=1.12.4:4
    ajax @ jquery.js?ver=1.12.4:4
    eme_add_booking_json @ eme.js?ver=2.0.48:167
    (anonymous) @ eme.js?ver=2.0.48:390
    dispatch @ jquery.js?ver=1.12.4:3
    r.handle @ jquery.js?ver=1.12.4:3
    
    Plugin Author Franky

    (@liedekef)

    If you put any echo/print in your discount code, it will cause a wordpress ajax error (the “an error has occurred” message). You can then check in your browser debugger, on the network-tab, what was being printed for your request.
    So I’m assuming something is wrong with your discount code. The first code you gave could not work, since you indicated this is a multiprice event.
    I’ll check out your second example.

    Plugin Author Franky

    (@liedekef)

    Ok, while I can’t reproduce the error “an error has occured” (no matter what I activate, WP_DEBUG, display_errors=on in php.ini), I did find out that the discounts of type code had issues since version 2.0.43.
    This is now corrected in the dev version (and your initial discount code can stay as is), so please try out the latest dev-version now.

    Thread Starter chochochocosensei

    (@chochochocosensei)

    Alright, now we are cookin’…You are probably right that it is my code. I apologize for my poor php skills — it is very much trial and error with me. After the hint you gave me, I was able to improve and debug my code better and I think I have code that is on the right track, but I think I am implementing it wrong…

    First, my discount:
    multipleChildDiscount multiple kids xxx No Yes 500 Code 0 144

    my revised code now that I can see what is inside $booking and that $booking[‘booking_seats’] has what I need:

    function my_eme_discount_function($booking) {
      var_dump($booking);
      $calculated_discount = 0; 
    // I tried this as a str as well....
      if ($booking['booking_seats'] > 1) {
    	$calculated_discount = 500; 
    // I tried this as a str as well....
      };
      var_dump($calculated_discount);
      $booking['discount'] = "500"; 
    //this is wrong, should be = $calculated_discount but I am testing...
      $booking['dcodes_used'] = "xxx";
      var_dump($booking);
      return $calculated_discount;
    }
    add_filter('eme_discount_multipleChildDiscount','my_eme_discount_function');

    The above code returns the following XHR:
    ["booking_approved"]=> int(1) ["booking_comment"]=> string(0) "" ["event_price"]=> string(10) "1000||1500" ["booking_paid"]=> int(0) ["pg"]=> string(0) "" ["pg_pid"]=> string(0) "" ["lang"]=> string(2) "en" ["discount"]=> string(0) "" ["discountids"]=> string(0) "" ["dcodes_entered"]=> string(6) "a:0:{}" ["dcodes_used"]=> string(0) "" ["dgroupid"]=> int(0) ["wp_id"]=> string(1) "1" ["booking_id"]=> int(665) } int(500) array(19) { ["event_id"]=> string(3) "120" ["person_id"]=> int(55) ["payment_id"]=> int(0) ["booking_seats"]=> int(2) ["booking_seats_mp"]=> string(4) "2||0" ["booking_approved"]=> int(1) ["booking_comment"]=> string(0) "" ["event_price"]=> string(10) "1000||1500" ["booking_paid"]=> int(0) ["pg"]=> string(0) "" ["pg_pid"]=> string(0) "" ["lang"]=> string(2) "en" ["discount"]=> string(3) "500" ["discountids"]=> string(0) "" ["dcodes_entered"]=> string(6) "a:0:{}" ["dcodes_used"]=> string(3) "xxx" ["dgroupid"]=> int(0) ["wp_id"]=> string(1) "1" ["booking_id"]=> int(665) } {"Result":"OK","keep_form":0,"htmlmessage":" my BR message with $TOTALDISCOUNT being 0, not 500 like it should be since booking seats is greater than 1."

    Originally I thought just returning $calculated_discount (is this int or str?) would work, but that didn’t seem to do it, so I tried to input the values directly into $bookings, but that feels like I am on the wrong track… I mean do I have to change all of ["discount"]=> string(3) "500" ["discountids"]=> string(0) "" ["dcodes_entered"]=> string(6) "a:0:{}" ["dcodes_used"]=> string(3) "xxx" ["dgroupid"]=> int(0) and if I do, to what??

    Again, I am sorry that my poor php skills is causing trouble here. What I want to do is very simple. It was working once, but now it seems like it isn’t…and many thanks again for your patient insight and direction…

    D

    Plugin Author Franky

    (@liedekef)

    This is working just fine, but you need to use the dev-version:

    
    function my_eme_discount_function($booking) {
      $calculated_discount = 0; 
      if ($booking['booking_seats'] > 1) {
    	$calculated_discount = 500; 
      };
      return $calculated_discount;
    }
    
    • This reply was modified 6 years, 5 months ago by Franky.
    Thread Starter chochochocosensei

    (@chochochocosensei)

    Installed dev version. sorry to say, but I a probably still doing something wrong…

    1. out of the box:

    leaflet.js?ver=2.0.48:5 Uncaught Error: Invalid LatLng object: (NaN, NaN)
        at new M (leaflet.js?ver=2.0.48:5)
        at Object.C [as latLng] (leaflet.js?ver=2.0.48:5)
        at HTMLDocument.<anonymous> (eme_location_map.js?ver=2.0.48:151)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)

    disabled the maps function and removed #_DIRECTIONS. no js but still getting “An error has occurred”. No bookings.

    developer tools is not showing any XHR output as before. The entry is there but it is just the page itself, not the print_r output.

    even if I completely blank out the discount function, I still get the error.

    reverting to stable eme for time being…will take a break, give you time to get the next update, and see how it goes from there.

    Plugin Author Franky

    (@liedekef)

    Your discount code works here, you seem to be mixing up several different things.
    If you get the “an error has occurred” and you see that the answer is the whole page, then there is a javascript error blocking the request (resulting in an empty form post that just shows the page again).
    When you’re testing dev-code, make sure to clean your browser cache.

    Thread Starter chochochocosensei

    (@chochochocosensei)

    Thank you. I see. After removing maps I stopped getting any js errors…but I will have to check more carefully. I need to set up a separate testing site, then I can try again.

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘no output suddenly’ is closed to new replies.