Home › Forums › Ticket Products › Event Tickets Plus › get the ticket cost by post id
- This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago by
Support Droid.
-
AuthorPosts
-
April 13, 2016 at 5:57 am #1101880
Riccardo
ParticipantHi,
i want get all the ticket costs and name by post id, I need to customize the prices filter because I have to exclude some elements by name form the minimum and maximum cost.
How can get it?
thanksApril 14, 2016 at 6:35 am #1102399Cliff
MemberHi Riccardo.
This is definitely something that falls into the “custom code” area, which we don’t necessarily support per our Scope of Support / Terms.
That being said, I might be able to help you along a bit:
- tribe_is_event()
- tribe_get_cost(), tribe_get_formatted_cost()
- tribe_get_minimum_cost(), tribe_get_maximum_cost()
If you need some coding help, you may want to ask your developer or reference our list of known customizers.
April 14, 2016 at 6:46 am #1102402Riccardo
ParticipantHi,
my problem is I had to write a function that exclude some ticket, so I have to keep only some tickets.
For example:
Aticket 10 euro
Aticket 20 euro
Bticket 50 euro
Cticket 100 euro
DTicket 150 euroI have to excluded the ticket “Aticket” and get the minimum and maximum cost among Bticket, Cticket, DTicket.
this i my problem!
How can I do it?
thanksApril 14, 2016 at 9:19 am #1102504Riccardo
ParticipantHi,
so I need:
– the tickets name (title)
– the tickets costSo I do a function by substring “the title of event” to exclude what I don’t want and then I create an array to get the minimum and maximum cost
Thanks
April 14, 2016 at 3:38 pm #1102761Cliff
MemberHave you tried the_title() or get_the_title() with each ticket’s Post ID (since I believe they’re all just custom post types)?
If that didn’t work, are you using Event Tickets’ “RSVP tickets”?
If you’re using Event Tickets Plus, which eCommerce plugin’s tickets are you using (e.g. WooCommerce)?
April 15, 2016 at 2:21 am #1102917Riccardo
ParticipantHi,
get_the_title() is the title of the post.
So I want the title of each tickets in the post.
I use Ticket Plus with WooCommerce integration!
thanksApril 15, 2016 at 6:20 am #1102960Riccardo
ParticipantHi,
the correct request is get all the ID of the post “tickets” related to post event.
thanksApril 15, 2016 at 4:20 pm #1103289Cliff
MemberRiccardo, thanks for clarifying your request.
Here’s some code that may help you:
function get_tickets_for_event( $event_id ) { $tickets = Tribe__Tickets__Tickets::get_all_event_tickets( $event_id ); $ticket_data = array(); // Build a list of ticket names and prices foreach ( $tickets as $single_ticket ) { $product = wc_get_product( $single_ticket->ID ); $ticket_data[] = array( $product->get_title(), $product->get_price() ); } return $ticket_data; }Then do what you want with it, for example:
foreach ( get_tickets_for_event( 123 ) as $ticket ) { echo "Ticket {$ticket[0]} costs {$ticket[1]}\n"; }We’ve already gone above and beyond our typical support policy (Scope of Support / Terms), so if you need additional help beyond this, you may want to ask your developer or reference our list of known customizers.
If it does help you get to your end goal, please let me know.
Thanks!
April 30, 2016 at 9:35 am #1109142Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘get the ticket cost by post id’ is closed to new replies.
