Posted: September 5, 2016 at 10:08 pm
|
Hi, we just implemented the PHP described here by Dean: However, I am a little lost on the logic and also had a question: 2. We are not understanding the logic flow. We have tested it on a page where we have 50 tickets available, with none purchased, and the output of the shortcode is “There are bucketloads of spaces left for Test-VIP” (where Test-VIP is our Event Name). How can the shortcode just display the “$remainderp” number? Then we could just write “The are [show_capacity EVT_ID=83] tickets still available” in the WordPress WYSIWYG editor (or whatever shortcode we need). Are there other useful threads you could direct me to, or perhaps just give a brief breakdown on the logic here? Really useful, thank you… |
Hi there,
You would need a completely different function as the function Dean posts only pulls in the DTT_name, DTT_reg_limit, DTT_sold fields for the datetimes on the event. It would likely be better to pull the information in using the EE4 Model System to get various bits of information as needed.
The function currently takes the event ID and pulls the datetimes for that event, it then loops over those datetimes and build out a UL of datetimes, each with adding another LI to the list and outputting the details for each specific datetime. To change that to just output the remaining spaces value you basically remove half the function but you would also need to use specific datetime ID’s rather than event ids (if you have more than one datetime EE will not know which datetime to output the details for and will just use the first it comes to for the event. It sound more like you need your own custom functions to pull the details you want in.
I’ve added some comments to the function here: https://gist.github.com/Pebblo/5ec81b6acc9fe06b8f8690b429b57d25 |
|
The support post ‘Displaying Available Tickets – Modifying Function and Shortcode Questions – EE4’ 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.