Admin events list: ticket counts

Home Forums Ticket Products Event Tickets Plus Admin events list: ticket counts

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #951694
    Motorco
    Participant

    I added a few lines of code to create an additional column on the admin view events list page that shows the total number of tickets sold for each event. This is *very* necessary and it would be awesome if you could add it to the codebase (bc putting it in a separate plugin is going to balloon this tiny bit of code).

    HOWEVER, there is some weirdness with Filters. The stock WP filters work just fine (date, category, etc). But the Organizer filter breaks my ticket count. Somehow the way the queries are layered, my calls to get the tickets from event are scrambled. The event ID is getting turned into a completely different, random number? Again, with either No filters or with standard WordPress filters, it all works great. But once I add an Organizer filter, ticket counts go to Zero bc for some reason, when it gets to get_all_event_tickets that method receives an invalid event id (post id). Any ideas?

    Here’s the method I added in tickets.php that gets called from custom_columns where I’ve added a new TixCount column:

    /**
     * JER
     * Returns total for all non-virtual tix
     *
     * @param null $event
     *
     * @return int
     */
    function tribe_get_tix_count( $event = null ) {
    	$count = 0;
    	if ( null === ( $event = tribe_events_get_event( $event ) ) ) {
    		return 0;
    	}
    	foreach ( TribeEventsTickets::get_all_event_tickets( $event->ID ) as $ticket ) {
    		$is_virtual = get_post_meta($ticket->ID, '_virtual', true); //'yes' or 'no'
    		if ( strcasecmp( 'yes', $is_virtual ) == 0 ) {
    			///don't care
    		} else {
    			$count += $ticket->qty_sold;
    		}
    	}
    	return $count;
    }
    #951755
    George
    Participant

    Hey Mike,

    We unfortunately cannot offer support for custom code…

    …however :), I’m curious exactly what you mean by “The Organizer filter”. Can you elaborate on this? Take screenshots and post versions of your function here to various Gists at http://gist.github.com if possible, just so we can get a better sense of all the moving parts in your issue here.

    We do have to limit how much time we can invest in custom code problems like this, but I understand your frustration and we’re happy to try and help as much as possible. We might at least be able to help spot the issues and point you in the right direction for fixing them.

    Let us know more about some of the details I mentioned here, and we’ll go from there.

    Thanks Mike!
    George

    #952108
    Motorco
    Participant

    Okay well what I posted is the extent of the code – save adding the extra column in custom_columns as I stated.

    The filters I’m talking about are those in the Events list admin view. Screenshot is here
    http://motr.co/tmp/snapshot2.png

    Everyone needs this functionality – to be able to see how many tickets, cumulatively, have sold for a given event. The Woocommerce reports don’t do that. This *would* be a simple bit of code, but some wordpress query weirdness is breaking it.

    #952816
    George
    Participant

    Hey Mike,

    I’m not sure what’s happening with your custom code – it’s possible something with the other code you have that hooks up the custom columns themselves is part of the problems you’re facing, though I can’t say that for certain.

    You are right about the importance of being able to tell how many tickets have sold for an event. And in case it’s helpful, I just wanted to point out a few places where you can already find this data – first, if your tickets have a stock, then if you go to the “Products” list in your admin generated by WooCommerce, then it will show the amount sold out of the stock. So if you have 25 tickets for sale, and 14 have sold already, the “stock” column in the “Products” page will show 14/25 for that ticket.

    Another place to find this is the WooCommerce > Reports page. You can see sales reports for each event’s tickets.

    Finally, on each event itself, there’s a “Sold” field next to the tickets that shows how many have been sold, without needing to set up a stock or anything.

    You may already be aware of all these things, and if so I apologize to repeat them to you, but just wanted to share all those options in case the trouble from creating a custom solution is not worth it.

    Cheers,
    George

    #952824
    Motorco
    Participant

    The woocommerce reports are difficult to use. Involves a lot of clicking to see the total number of tickets sold and it only shows one “product” at a time. I initially was going to hack into that tot get some better reporting, but it’s a complex structure.

    Product list is actually totally useless. We have different “stock” levels for each event. It also is very cumbersome in terms of dates. I don’t need to see counts for shows that have already passed.

    The events list admin view is the *perfect* place for this info since the “report” is so easy to configure and there are lots of options for filtering by date, category, etc. And it turned out to be such a tiny bit of code – altho of course it doesn’t work w/ the Organizer filter which is key since I need to send ticket counts to individual Organizers.

    I’ll continue to try and debug this issue – I just figured you guys would have some insights. Ip’m certain it has to do with the layering of the queries since there’s a query to get the events for the filter (organizer) and then another one for the “has tickets”.

    #952836
    George
    Participant

    I hope you do keep playing with this, and am sorry about how little we can support and delve into customizations like this. Your feedback is interesting though, and I see why you’d want this sort of column in your main Events admin screen.

    I can create a feature ticket for this idea in our central project management tool, and if other devs agree on implementing this, we can add it in a future update. If you’d like to help bring more attention to this feature idea, definitely post about it on our UserVoice page here → http://tribe.uservoice.com/forums/195723-feature-ideas

    That will help us weigh in on what’s important when it comes time to figure out new features for a future release.

    Thanks Mike, best of luck with your project here.
    George

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Admin events list: ticket counts’ is closed to new replies.