Hi Stephen,
I need to overide the inline style in the confirmation email ticket grid.
%tickets%
The default style is text-align:center; for the table – i want text-align:left.
I can’t do this with the email template or in the booking email editor – is there any way to change?
Thanks
Alex
-
This topic was modified 9 years, 10 months ago by
Alex Steer.

Alex Steer
There’s a filter for this (filters the HTML mark-up for the tickets table). It’s probably easiest to replace the HTML wholesale:
add_filter( 'eventorganiser_email_ticket_list', 'my_tickets_table', 4, 10 );
function my_tickets_table( $tickets_table_html, $booking_tickets, $booking_id, $template ){
//Replace $tickets_table_html with the desired HTML mark-up
//$booking_tickets is an array containing tickets (and quantity thereof) booked
//$template is the identifier for the template selected -- allows for
//per template styling.
}
Although its best to replace the HTML wholesale – it’ll be easiest to do this to take the php code and modifiy it. The original table is created via eventorganiser_email_ticket_list()
in includes/emails.php
(line~683) – you can use the body of that function in the above, and then modify the styles as desired.

Stephen Harris
Thanks for your reply Stephen.
Is it possible to get a working example of this filter?
I have located the html
$booking_table = sprintf(
'<table style="width:100%%;text-align:center;">
<thead style="font-weight:bold;"><tr> <th>%s</th><th> %s </th> <th>%s</th></tr></thead>
<tbody>',
__( 'Ticket', 'eventorganiserp' ),
__( 'Price', 'eventorganiserp' ),
__( 'Ref.', 'eventorganiserp' )
);
foreach ( $booking_tickets as $ticket ) {
$booking_table .= sprintf(
'<tr> <td>%s<td> %s </td> <td>%s</td></tr>',
esc_html( $ticket->ticket_name ),
eo_format_price( $ticket->ticket_price ),
$ticket->ticket_reference
);
}
$booking_table .= apply_filters( 'eventorganiser_email_ticket_list_pre_total', '', $booking_id );
$booking_table .= sprintf( '<tr> <td>%s</td><td> %s </td> <td></td></tr></tbody></table>', __( 'Total', 'eventorganiserp' ), eo_format_price( $total_price ) );

Alex Steer
Thanks for looking at this.
Also, is the double %% meant to be in the CSS?

Alex Steer
Hi Alex,
Please see http://wp-event-organiser.com/forums/topic/tickets-table/ for a working example.
The reason for the double %
(%%
) – is because the HTML is passed through sprintf()
. %
is a special character which needs to be escaped, hence whenether a literal %
is required, it must be repeated.

Stephen Harris
Cool, thanks for the link.

Alex Steer