• Resolved thor86

    (@thor86)


    Hi,

    Thank you so much for this great plugin and for all your work!
    I’ve been scratching my head with this issue the last days and I hope you can help me. I am using the #_BOOKINGBUTTON placeholder and I would like it automatic change to display cancel this booking (after the user books an event) or Book Now (after the user cancels an event). Currently it only updates after the user refreshes the page, but I am trying to make that happen automatically without having to refresh the page.

    Many thanks in advance!

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi,

    If you set Settings > Bookings > General Options > Allow double bookings?(set to NO) it should automatically changed to Cancel

    Thread Starter thor86

    (@thor86)

    Hi angelonw,

    Thank you for your fast answer.
    I have that option selected, but after I book an event it displays “Booking submitted” instead of changing to display: “Cancel”. After I refresh the page it displays “Cancel” but I need it to automatic change the message to Cancel without having to refresh the page.

    Hi,

    maybe you can try this snippet and then change the text of the #_BOOKINGBUTTON

    paste in your theme header.php inside <head> tag
    <script>
    <head>
    <!-- lets placed it just above </head> -->
    jQuery(document).ready( function($){
    	jQuery(document).bind('em_booking_success', function(){
    		$('.em-booking-message-success').append('<div><p>hi.....</p></div>');
    	});
    });
    </script>
    </head>
    Thread Starter thor86

    (@thor86)

    Hi,

    Unfortunately it doesn’t seem to work:( I added an alert below jQuery(document).bind(’em_booking_success’, function(){ and it doesn’t fire:(
    But I think it needs more than simply changing the button text, because for example if there is:
    Cancel
    After I click the button html tag is:
    Cancelled
    and the button html tag should be:
    Sign-up, so basically the button html tag should completely change automatic, but that happens after refreshing the page, and I need it to happen automatic.

    Can you help me please with that?
    Many thanks in advance!

    Thread Starter thor86

    (@thor86)

    Let me resend the code for the button html tags:
    if the button html tag is:
    <a class="button em-cancel-button" id="em-cancel-button_343_4989760374">Cancel</a>
    after I click it it becomes:
    <a class="button em-cancel-button" id="em-cancel-button_343_4989760374">Cancelled</a>
    and it should automatic become: <a class="button em-booking-button" id="em-booking-button_404_b4f0a9cd96">Sign-up</a>
    but that only seems to happen after refreshing the page and I need it to automatic happen after clicking on the Cancel button.

    Thanks!

    Thread Starter thor86

    (@thor86)

    Can you give me please an indication for this? Thank you!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    you’d need to createa wordpress hook and modify the output

    echo EM_Object::json_encode(apply_filters('em_action_'.$_REQUEST['action'], $return, $EM_Booking));

    the filter would be called – em_action_booking_add_one

    Thread Starter thor86

    (@thor86)

    Hi Marcus,

    Thank you for your answer, can you tell me please in what file should I paste the code that you wrote?

    Thanks!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    The code I wrote is a line on our code, we can’t write this code for you.

    You need to create some code to modify this stuff yourself, using the em_action_booking_add_one filter.

    You should look at the returned AJAX json queries to see what is passed into that filter so you know what to change.

    Thread Starter thor86

    (@thor86)

    Hi Marcus,

    Thank you very much for all your help, you are great! I will follow your instructions and I hope to find a resolution to my issue.

    Cheers!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘#_BOOKINGBUTTON automatic change from Book Now to Cancel This booking’ is closed to new replies.