CSV Export Delimiter – missing headers
-
Hi
thanks for introducing the constant for changing the delimiter.
However, I found that the header columns are not crediting the constant, when set. While they still use “,”, the data is using “;” for export.I fixed it hardcoded in EM files and askl you to fix for next release, so I don’t need to patch it again:
$delimiter = !defined('EM_CSV_DELIMITER') ? ',' : EM_CSV_DELIMITER; $delimiter = apply_filters('em_csv_delim', $delimiter); echo '"'. implode('"'.$delimiter.'"', $EM_Bookings_Table->get_headers(true)). '"' . "\n"; //Rows $EM_Bookings_Table->limit = 150; //if you're having server memory issues, try messing with this number $EM_Bookings = $EM_Bookings_Table->get_bookings(); $handle = fopen("php://output", "w"); while(!empty($EM_Bookings->bookings)){ foreach( $EM_Bookings->bookings as $EM_Booking ) { //Display all values /* @var $EM_Booking EM_Booking */ /* @var $EM_Ticket_Booking EM_Ticket_Booking */ if( $show_tickets ){ foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking){ $row = $EM_Bookings_Table->get_row_csv($EM_Ticket_Booking); fputcsv($handle, $row, $delimiter); } }else{ $row = $EM_Bookings_Table->get_row_csv($EM_Booking); fputcsv($handle, $row, $delimiter); } }
You may noticed also a filter was added by me – the alternative approach for me, as I inserted in the export dialoge
– “export all fields” button
– “export using THIS delimiter” input field
- The topic ‘CSV Export Delimiter – missing headers’ is closed to new replies.