Home › Forums › Ticket Products › Event Tickets Plus › How do I show how many tickets are available on the front end?
- This topic has 5 replies, 2 voices, and was last updated 10 years, 10 months ago by Barry.
-
AuthorPosts
-
May 13, 2013 at 3:46 pm #48404MikeParticipant
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?
May 14, 2013 at 12:51 am #48426BarryMemberHi 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 🙂
May 15, 2013 at 12:09 am #48542MikeParticipantCustomizing 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/Fg7p43ZdThoughts?
May 15, 2013 at 12:16 am #48543MikeParticipantOh, 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.
May 15, 2013 at 6:40 am #48567BarryMemberSo 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.
May 28, 2013 at 10:18 am #49971BarryMemberIt’s been a while so I guess we’re all good here – I’ll go ahead and close this thread.
-
AuthorPosts
- The topic ‘How do I show how many tickets are available on the front end?’ is closed to new replies.