Need to display remaining tickets
WordPress Event Management, Calendars & Registration › Forums › General Question › Need to display remaining tickets
This topic contains 6 replies, has 2 voices, and was last updated by Stephen Harris 9 years, 7 months ago.
-
AuthorPosts
-
July 28, 2015 at 6:29 pm #18131
Hi,
I am not familiar enough with php to figure this out on my own (http://codex.wp-event-organiser.com/function-eo_get_remaining_tickets_count.html).
One of my events is:
http://katalyst5.com/wp/learn/en/events/event/maximize-your-linkedin-3hrs/I want to display the remaining ticket count for each single event in two locations:
- As a first bullet in the event Details;
- In the booking form, next to the Quantity picker.
Can you help me?
Thank you!
Benoit
Benoit David
July 28, 2015 at 7:55 pm #18132Hi Benoit,
Are you booking by date or by series? If ‘by date’ then remove the
eo_get_the_occurrence_id()
below:In the
event-organiser/templates/single-meta-event-single.php
you’ll see:<li> <?php eo_the_start($date_format) ?></li>
you can replace that with:
<?php printf( '<li> %s (Tickets remaining: %d)</li>', eo_get_the_start( $date_format ), eo_get_remaining_tickets_count( get_the_ID(), eo_get_the_occurrence_id() ) ); ?>
-
This reply was modified 9 years, 7 months ago by
Stephen Harris.
Stephen Harris
July 28, 2015 at 8:40 pm #18134Hi Stephen,
Thanks for the quick response!
I can only find a file named “event-meta-event-single.php”. Is that the one?
I found the line to replace, replaced it, but it has no effect.
Benoit David
July 29, 2015 at 1:25 pm #18148Please disregard the question below – Just figured out. It’s the Simple Booking Mode option in the Booking Forms Editor.
<hr />
I noticed something else that’s weird. I had put a test ticket of $1 to test my gateways, and after I removed it, the number of ticket selection is gone!
How can I put it back?
Thanks!
-
This reply was modified 9 years, 7 months ago by
Benoit David.
Benoit David
July 30, 2015 at 8:50 am #18166Hi Benoit,
That’s the one. It should change the display of dates at the top of the page. Can you check the plugin settings (General tab) to ensure templates are enabled.
Also, if there is a copy of that template in your theme you should make the changes there.
Stephen Harris
July 30, 2015 at 12:22 pm #18172Hi Stephen,
I got it to work in the event meta. thank you.
What about in the booking form? I managed to put it right before the Ticket Picker table, but I’d like to append the quantity to the 3rd column (Quantity).
I think I found the place in eo-ticket-picker.php: the table seems to be create din lines 63 to 80.
…
<tr id=”eo-booking-ticket-<?php echo $ticket_id;?>” style=”border-top:none”
class=”eo-booking-ticket-row <?php echo $class;?>”
<?php eo_booking_form_ticket_data_attr( $ticket); //Add ticket data attributes – required for JS ?>
><td class="eo-booking-ticket-name"> <?php echo esc_html( $ticket['name'] ); ?> </td> <td class="eo-booking-ticket-price"> <?php echo eo_format_price( $ticket['price'], true ); ?> </td> <td class="eo-booking-ticket-qty"> <?php $value = ( isset( $input['tickets'][$ticket_id] ) ? $input['tickets'][$ticket_id] : 0 ); ?> <input type="number" class="<?php echo esc_attr( $this->element->get_class() );?>" data-eo-ticket-qty="<?php echo esc_attr( $ticket_id );?>" name="eventorganiser[booking][tickets][<?php echo esc_attr( $ticket_id );?>]" max="<?php echo $spaces; ?>" style="width:auto;" min="0" value="<?php echo esc_attr( $value );?>" /> </td> </tr>
I tried to add it, but it breaks the table.
The title of the column would become “Quantity/Available” in English and “Quantité/Disponible(s)” in French.
In each row, the info would be added right after the quantity box, like “/”+ number of tickets left.I made a mockup of it: http://www.screencast.com/t/neGO8jLsF
Is that possible for you to modify the code for me?
Thank you so much!
Benoit
Benoit David
August 1, 2015 at 7:12 pm #18213This will only work if selling by series or for single-occurrence events (i.e. when there’s no datepicker involved). But simply add
$occurrence_tickets = eo_get_the_occurrences_tickets( $event_id );
at the top of the
eo-ticket-picker.php
and then replace
<input type="number" class="<?php echo esc_attr( $this->element->get_class() );?>" data-eo-ticket-qty="<?php echo esc_attr( $ticket_id );?>" name="eventorganiser[booking][tickets][<?php echo esc_attr( $ticket_id );?>]" max="<?php echo $spaces; ?>" style="width:auto;" min="0" value="<?php echo esc_attr( $value );?>" />?>
with
<input type="number" class="<?php echo esc_attr( $this->element->get_class() );?>" data-eo-ticket-qty="<?php echo esc_attr( $ticket_id );?>" name="eventorganiser[booking][tickets][<?php echo esc_attr( $ticket_id );?>]" max="<?php echo $spaces; ?>" style="width:auto;" min="0" value="<?php echo esc_attr( $value );?>" />/<?php echo intval( $spaces );?>
That is, just add
/<?php echo intval( $spaces );?>
to the end.
Stephen Harris
-
AuthorPosts