Home › Forums › Ticket Products › Event Tickets Plus › Attendee List Add Guest Name Column
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by Gustavo Bordoni.
-
AuthorPosts
-
April 15, 2015 at 4:19 am #955656Simon GrovesParticipant
Hi,
I really hope you can help!
We’ve added a plugin which allows custom fields to be added for each ticket – which is superb and is a shame it’s not an out of the box function! This allows us to sell a ticket and add guest tickets capturing guest info
What we’d like to do is show/add a column to the event attendee list with the guest names. Otherwise, if Joe Bloggs purchases 5 tickets, his name is shown 5 times in the attendee list, which seems a tad intuitive as really it should be the guest names.
Is this something you can assist with?
Many thanks
April 16, 2015 at 5:36 am #956000Simon GrovesParticipantHi All,
Just following on from this and hope someone can help.
When tickets are purchased, I’ve got custom fields which collect Name, Email and Phone for each ticket. This stores the custom fields as :
X Attendee Name
X Attendee Email
X Attendee Phone
Where X is the number, so in one order, if 2 tickets are purchased, the above would be used three times like so:
1 Attendee Name
1 Attendee Email
1 Attendee Phone2 Attendee Name
2 Attendee Email
2 Attendee PhoneAlls fine so far. I’ve then found this tuturial: http://jaredcamarata.com/how-to-add-name-to-attendee-list-table-for-wootickets/
So wish to add an extra column ‘Guest Name’. Problem is, I need to loop the below to get the desired info:
$order = new WC_Order( $item['order_id'] ); $items = get_post_meta( $order, '1 Attendee Name', true ); return $items;
At the moment, that will return the first name input for both tickets.
I can see that in the attendee list table there is a column called Ticket# which increments the number of tickets per order.
What I’m trying to do, is find where this is generated, so I can do something like:
$i=0; foreach($qty as $quantity){ $i++; $items = get_post_meta( $item['order_id'], $i.' Attendee Name', true ); }
Hopefully, this will get me in the right direction.
Any help is much appreciated at this point as it’s driving me mad!!!
April 17, 2015 at 12:48 am #956183Simon GrovesParticipantI’ve managed to code up a solution, I’m not a coder but the below works (not sure if there was a better way of doing this either!):
function column_name( $item ) { global $wpdb; $order_id = $item['order_id']; #echo 'ORDER ID: '.$items.'<br/>'; #DEBUG $attendee_id = $item['attendee_id']; #echo 'ATTENDEE ID: '.$attendee_id.'<br/>'; #DEBUG $query = " SELECT * FROM <code>$wpdb->postmeta</code> WHERE <code>meta_key</code> LIKE '_tribe_wooticket_order' AND <code>meta_value</code> LIKE '".$order_id."' ORDER BY <code>hacc_postmeta</code>.<code>post_id</code> ASC "; $rows = $wpdb -> get_results($query); #echo $wpdb->num_rows . ' Rows Found<br />'; #DEBUG $i=0; foreach ( $rows as $row ) { $i++; $user_meta = $row->post_id; #echo $user_meta.'<br/>'; if ($user_meta == $attendee_id) : echo get_post_meta( $item['order_id'], $i.' Attendee Name', true ); endif; } return $items; }
Hope that helps someone else. Only downside is when an update is made to the plugin, this will be replaced (I assume) so just bear it in mind!
April 17, 2015 at 1:08 am #956186Gustavo BordoniKeymasterHi Simon,
Thanks for reaching out to us, and I would like to mention that yeah that is not a good behavior but if it solves your issue for now it’s good.
I will say that this kind of feature development we normally don’t create for users because it will require too much development from the team, and here on the forum we are only doing support.
My Best Regards,
-
AuthorPosts
- The topic ‘Attendee List Add Guest Name Column’ is closed to new replies.