Events Made Easy Forums How do I … Reserve a block of seats? Pulling my hair out…

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #53584
    Anonymous
    Inactive

    I love the plugin.

    The install & setup were a breeze. Really enjoying the functionality so far…

    I encountered one problem, and have spent over 3.5 hours researching in the forums etc.

    How can I reserve a block of seats? I have used multiseat and multiprice, and been unable to enable the feature that I require.

    What I would like to employ:
    Three tiers of event reservation, each with different price.
    1. Individual – $50
    2. Couple – $90
    3. Table (8) – $450

    Obviously the number of individual reservations is equal to what the user selects.

    For couple, $_RESPSPACES needs to be double the user input (as they are selecting and paying for that # of couples).

    For table, $_RESPSPACES needs to be user input * 8.

    I have been unable to achieve this using a variable in php, attempting to simply multiply the inputs and then send the value back to $_SEATS{x}.

    Thank you so much for the assistance! I’m pulling my hair out here!

    – Nick

    #53585
    Franky
    Keymaster

    Sounds to me that you don’t want multiprice/multiseat, but just discounts …
    There’s a discount example in the doc about filters and actions.
    If you really want multiprice events, create an evaluation filter that checks the total number of seats already booked for that event.

    #53586
    Anonymous
    Inactive

    Thank you very much Franky.

    I am able to implement the discount feature from the example. I am, however, not fully satisfied with that outcome.

    I wrote an action and I am unsure why it is not working. It is, in fact, returning “0” for # of seats instead of (A) the # input by user or (B) the desired # based on the php (i.e. “Couples tickets” = #_SEAT2. php states $seats[1] = $seats[1]*2, yet returning 0)

    Here is the code. I am using multiprice in order to keep the appropriate price in line with # of seats. I just need to change # of seats before processing (i.e. “Table” is 8 people, and “Table” = #_SEAT3. php states $seats[2] = $seats[2]*8, yet returning 0)

    Here is the code:

    add_action('eme_insert_rsvp_action', 'my_eme_seatblock_function',20,1);
    function my_eme_seatblock_function($booking) {
       global $wpdb;
       $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
       $where = array();
       $fields = array();
    
       $booking_id = $booking['booking_id'];
       $event_id = $booking['event_id'];
    
       
           
          $seats=eme_convert_multi2array($booking['booking_seats']); // $seats is now an array for the different seat categories defined
    
          if (eme_is_multi($booking['booking_seats'])) {
          	$seats[1] = $seats[1] * 2;
          	$seats[2] = $seats[2] * 8;
          }
    
          if (eme_is_multi($booking['booking_seats']))
              $fields['booking_seats'] = eme_convert_array2multi($seats);
          else
              $fields['booking_seats'] = $seats;
          $where['booking_id'] = $booking['booking_id'];
          $wpdb->update($bookings_table, $fields, $where);
       return;
    }

    Any help would be dramatically appreciated. Making sure to donate. Thanks so much.

    – Nick

    #53587
    Franky
    Keymaster

    Your code can be optimized a lot, but if it is not working: add some print_r($seats) statement to it, followed by die(); then you’ll see what is in the array …
    But changing the number of seats in a multiprice event is tricky …
    I would go about this in another way:
    – no multiseat or multiprice
    – add 2 extra dropdown fields for couple and table selections

    Use the normal discount filter to check for the value of the extra dropdown fields to increase the number of seats, reduce the price and update booking_price too (all in the same booking table).

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top