Support

Home Forums Event Espresso Premium Custom Ticket Selector Template?

Custom Ticket Selector Template?

Posted: February 26, 2015 at 8:27 pm


Tyler Longren

February 26, 2015 at 8:27 pm

Hi!

I have a client who wants to have a setup similar to the page here:
http://www.richnessoflife.org/spokane/

Basically two courses, and each course consists of two days.

How can I accomplish that by way of tickets and datetimes? Or am I going about that totally wrong?

Also, the register buttons have custom text, which I assume is accomplished through a template, but am not sure which to copy to my child theme.

I am very familiar with Advanced Custom Fields, and have managed to modify the Table View Addon template and incorporate data from ACF into it, but I’m stumped on the actual event page/pricing section.

Any guidance would be greatly appreciated.

Thanks!


Tyler Longren

February 27, 2015 at 6:51 am

Here’s a screenshot of how I have my tickets and datetimes setup currently.

Setup


Lorenzo Orlando Caum

  • Support Staff

February 27, 2015 at 10:11 am

Hi Tyler,

The ticket selector in Event Espresso 4 will show available tickets for purchase. According to your screenshot, it would show a discounted ticket and a regular ticket.

Here are two ideas.

IDEA 1
I would split this event into two events — one for the first morning and second morning and the other for the first night and the second night. That will then allow you to use the ticket selector shortcode for EE4 on a WP page:

https://eventespresso.com/wiki/ee4-shortcodes-template-variables/#ticket-selector

IDEA 2
The other option is to create two more tickets in the existing event. Then edit the ticket names so they look like this:

Discounted Ticket – Morning course
Regular Ticket – Morning course
Discounted Ticket – Night course
Regular Ticket – Night course

Then assign the tickets (click on the gear icon on each datetime and place a checkmark for each ticket) to the appropriate datetimes (i.e. assign night tickets to the night course and morning tickets to the morning course).

One other step that you may consider is hiding the upcoming ticket options by using this line of CSS:

/* Hide a tickets option with a status of upcoming */
.post-type-archive-espresso_events .ticket-pending {display:none;}

More information on CSS for different ticket statuses is available here:

https://gist.github.com/lorenzocaum/7c1d3dce3c9efe486361


Lorenzo


Tyler Longren

February 27, 2015 at 12:31 pm

Thanks a TON Lorenzo!

So I should use the shortcodes in custom templates in my child theme?

I’m used to working with Woocommerce and being able to copy a core Woocommerce template file and drop it in my child theme and modify at will.

That must not be possible with EE4, at least from what I’ve read.

Again, thanks for your reply, it helps a lot.


Lorenzo Orlando Caum

  • Support Staff

February 27, 2015 at 1:01 pm

Hi Tyler, the shortcodes can be used on a WordPress page. You could also add them via a do_shortcode to your template file:

http://codex.wordpress.org/Function_Reference/do_shortcode

It sounds like you wanted to create a custom layout on a page and then add the two two selector options. The ticket selector itself can’t be broken up for a single event. However, if you create two events (one for morning and one for night), then that would provide you with two ticket selector shortcodes.

Does that help?

The other option is to add more ticket options and then use the default event page (idea 2).


Lorenzo


Tyler Longren

February 27, 2015 at 1:31 pm

That also helps immensely. I really do appreciate the help Lorenzo. 🙂


Tyler Longren

March 1, 2015 at 3:46 pm

Made crazy progress lorenzo, via method 1. Any tips on how I can show the price? I have the events table view addon, and am using it’s shortcode on a page like so:
[ESPRESSO_EVENTS_TABLE_TEMPLATE template_file=”espresso-events-table-custom.php”]

espresso-events-table-custom.php rests in the root of my child theme. I’ve been able to add new table columns, rearrange them, etc.

However, I can’t seem to pull a price for the event, when I echo espresso_event_tickets_available(), I get this:
Two Discounted Tickets, Each Event

Now, I get why the “regular ticket” isn’t there, it’s not yet available for purchase.

Just not sure why there’s two discounted tickets showing for one event. Have a feeling I should be using something other than espresso_event_tickets_available().

Can you advise, Lorenzo? Input from others is of course welcome as well.


Tyler Longren

March 1, 2015 at 9:50 pm

As a quick work around, I’ve used ACF to enter a price for the event. Resulting in:


Josh

  • Support Staff

March 5, 2015 at 7:26 am

Hi Tyler,

There are a few methods that you can use to grab the price of the first input ticket and display its price. Here’s some example code:

if ( $post->EE_Event instanceof EE_Event ) {
  $ticket_array = $post->EE_Event->first_datetime()->tickets();
  $first_ticket = array_shift($ticket_array);
  echo $first_ticket->pretty_price();
}

You’ll note that it gets an array of prices because events and datetimes can have more than one ticket, each with their own price. The array_shift() is a simple way to get the first entered ticket’s price. You can certainly add on to the code and make it more complicated in order to get other prices.


Tyler Longren

March 5, 2015 at 10:55 am

Exactly what I was looking for Josh, this will help immensely, and makes ACF no longer required.


Josh

  • Support Staff

March 6, 2015 at 8:58 am

You’re welcome Tyler.

The support post ‘Custom Ticket Selector Template?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso