Support

Home Forums Event Espresso Premium Shortcode for Tickets Sold for an Event

Shortcode for Tickets Sold for an Event

Posted: October 28, 2019 at 4:23 pm

Viewing 3 reply threads


Adam Bowie

October 28, 2019 at 4:23 pm

Hi guys,
I came across this thread where Josh had provided a code snippet that adds a shortcode to output a list of tickets issued for a single event:
https://eventespresso.com/topic/event-attendees-ticket-count-using-short-code/
I tried the code snippet referred to in that thread (https://gist.github.com/joshfeck/73e10a9b14bde1805c28896e31b3c6d3) and it seems to work great… but in our case, it is only outputting a list of tickets that are currently “On Sale”. We have several archived Ticket Types that do not show up.

This would be extremely useful for us, so we can have an internal page for employees that tallies this information.

Is there a way to tweak this snippet to include the archived tickets? Or is there perhaps another modification we have in place that is preventing the archived tickets from being included?

These are the only tickets that are showing in the snippet output:
https://share.getcloudapp.com/o0ux711m

Thanks for the help!
Adam


Tony

  • Support Staff

October 28, 2019 at 4:43 pm

Hi Adam,

If you change line 18 from this:

$tickets = $event->tickets();

to this:

$tickets = $event->tickets(array('default_where_conditions' => 'none'));

Do you now get all of your tickets?


Adam Bowie

October 28, 2019 at 5:19 pm

Tony… Awesome, worked perfectly with that change.


Tony

  • Support Staff

October 29, 2019 at 4:39 am

The EE models are pretty awesome (and no, I didn’t write them 😉 ), you can pull pretty much any data you need from most of the objects without much difficulty.

I’d recommend taking a read of the docs here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

Once you figure out how one of the models works you can work with them all.

Viewing 3 reply threads

The support post ‘Shortcode for Tickets Sold for an Event’ 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