«Sold out» in eo_fullcalendar / agendaWeek

WordPress Event Management, Calendars & Registration Forums General Question «Sold out» in eo_fullcalendar / agendaWeek

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 8 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25601

    Hi Stephen
    Once more: your plugin is brilliant – and makes fun to work with.
    I could not solve an issue even after investigations for hours. Could you kindly help me with the following:
    I am using the eo_fullcalendar with agendaWeek.
    How can I adjust the content of the fc-content?
    I want to add a «sold-out»-mark when there are no tickets left and second I want to add the author (here: teacher) to the full calendar. (see screenshot)!
    Thanks for your help in advance.
    Cheers, Benjamin.

    Screenshot

    Benjamin Ogg
    #25640

    I think the only way to do this is to use the eventorganiser_fullcalendar_event hook to inject any extra data for each event (see codex: http://codex.wp-event-organiser.com/hook-eventorganiser_fullcalendar_event.html) – note that the calendar is cached. After making any changes, update an event to clear the cache.

    Then, you can use the following JS-hook (see https://github.com/carldanley/WP-JS-Hooks for background):

    addFilter( 'eventorganiser.fullcalendar_render_event', function( render, event, element, view ){
           console.log( event ); //for debugging, the contents of the event object.
           console.log( element ); //for DOM element corresponding to this event.
    
           return render;
    });
    

    The element should contain the mark-up for the event cell, so you can modify it as you wish using jQuery.

    I’m confident that it will work, but I’ve not tested it. So you may want to try manipulating the element before you try to pass data to your code via the eventorganiser_fullcalendar_event filter.

    Stephen Harris
    #25653

    Cheers, Stephen! That helped.

    I am adding the following code to the eventorganiser_fullcalendar_event function:

    $remaining = eo_get_remaining_tickets_count( $event_id, $occurrence_id );
    if ( $remaining == 0 ) :
    $event['title'] .= 'soldout';
    endif;
    

    Is it possible to wrap the «soldout» with a span or div for styling reason?

    Benjamin Ogg
    #25659

    Hi Benjamin,

    No you won’t be able to as it escapes any HTML.

    What you can do is set:

    $event['_is_sold_out'] = eo_get_remaining_tickets_count( $event_id, $occurrence_id ) >0 ? 1 : 0;
    

    and then in the JS callback check the event object, and manipulate the DOM element accordingly. (You’ll need to do the mark-up changes client-site). I’ve not tried, but

    $(element).append( '<span>sold out</span>' );
    

    might work.

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.