• Resolved eivic

    (@eivic)


    Hello,

    First of all, I wanted to thank you for creating such an easy to use plugin – it has been a lifesaver!

    I am looking to remove any columns that are empty. We currently have a large array of product types, so often times columns are unused within the export.

    • This topic was modified 4 years, 7 months ago by eivic.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    What format do you use ?

    Thread Starter eivic

    (@eivic)

    We’re exporting to CSV

    Plugin Author algol.plus

    (@algolplus)

    how many orders do you export ? 100? less?

    does button “export w/o progress” work ok for your export ?

    Thread Starter eivic

    (@eivic)

    I believe we only export a small number of orders at a time, between 1 and 5 orders.

    The “export w/o progress” does work, but we still experience empty columns.

    I don’t think I’ve properly explained myself in the original post, my apologies. We have multiple product types, so for example, if we are exporting an order with just an apron product the export still displays the columns for prescription glasses and other products. This causes the CSV to be quite large. We want to dynamically hide columns whenever they aren’t used. The columns are empty but have the correct heading. (Hope I’ve explained myself better).

    Plugin Author algol.plus

    (@algolplus)

    Hello

    Yes, I understand you, but could you submit your settings as new ticket to https://algolplus.freshdesk.com/?

    Use >WooCommerce>Export Orders>Tools to get them.
    thanks, Alex

    Plugin Author algol.plus

    (@algolplus)

    for whom having same problem with CSV — just add this code to section “Misc Settings”

    ​@session_start();
    add_filter( "woe_csv_header_filter", function( $headers) {
       $_SESSION['woe_rows']= array();
       return $headers;
    });
    //save all rows to array
    add_filter( "woe_csv_custom_output_func", function($custom_output,$handle,$data,$delimiter,$linebreak,$enclosure,$is_header) {
       $_SESSION['woe_rows'][] = array_values($data);
       return true;
    },10,7);
    add_action( "woe_csv_print_footer", function($handle, $formatter ){
       $header = reset($_SESSION['woe_rows']);
       foreach($header as $col=>$name) {
         $col_empty = true;
         for($i=1;$i<count($_SESSION['woe_rows']);$i++) {
                 if( !empty($_SESSION['woe_rows'][$i][$col])) $col_empty = false;
         }
         if($col_empty) 
           for($i=0;$i<count($_SESSION['woe_rows']);$i++) unset($_SESSION['woe_rows'][$i][$col]);
       }
       //done 
       foreach($_SESSION['woe_rows'] as $row) fputcsv($handle,$row);
    },10,2);
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Hiding/Removing empty columns from the export’ is closed to new replies.