How do I show how many tickets are available on the front end?

Home Forums Ticket Products Event Tickets Plus How do I show how many tickets are available on the front end?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #48404
    Mike
    Participant

    I would like to show my users how many tickets are currently available on the front end, on the ticket.php page and possibly even the venue/gridview/upcoming events widget. How is this possible?

    #48426
    Barry
    Member

    Hi Mike –

    You can certainly change your ticket.php template to show remaining stock – this thread might give you some ideas on how to do that.

    Customizing widgets is a little more involved so please check out our Themer’s Guide and relevant tutorials (links in the Useful Resources section over on the right). A useful snippet that can help you to pull the product data for any tickets associated with events can be found here.

    I hope that gives you some ideas to get started with 🙂

    #48542
    Mike
    Participant

    Customizing the table.php view with the following code http://pastebin.com/DPBH5Nae gives the following error:

    Fatal error: Cannot redeclare get_wooticket_products() (previously declared in /home/mpatino/public_html/wp-content/themes/DynamiX/events/table.php:147) in /home/mpatino/public_html/wp-content/themes/DynamiX/events/table.php on line 147

    Here is the full table.php file:
    http://pastebin.com/Fg7p43Zd

    Thoughts?

    #48543
    Mike
    Participant

    Oh, and the previous snippet worked perfectly for the ticket.php page. It’s just the gridview calendar, venue calendar, and upcoming events widget that are giving me problems.

    #48567
    Barry
    Member

    So although you can use the same function lots of times you can only define it once (and a snippet like this contains a function definition).

    Though there are a few places you could you to house functions like get_wooticket_products() the best place if you are unsure is in your theme’s functions.php file – you can then use it from all of your theme templates.

    In summary:

    • Define your custom functions (a definition normally looks a little like function blah() { /* code */ } ) once only and place it in your theme functions.php file
    • You can then use it from all of your theme templates, at least where it makes sense to do so, by calling it (a function call looking something like blah(); )

    It’s definitely well worth reading up on some tutorials to learn the basics of PHP before attempting to do work like this as there are a few bear traps out there.

    #49971
    Barry
    Member

    It’s been a while so I guess we’re all good here – I’ll go ahead and close this thread.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How do I show how many tickets are available on the front end?’ is closed to new replies.