Support » Plugin: Advanced Order Export For WooCommerce » Customer_Total_Orders Field

  • Hi, first thanks for the great plugin.

    I’m looking to format a sales ranking through the report.

    However, the Customer_Total_Orders field does not match the selected filters.

    Regardless of the selected date or the status of the selected orders, the Customer_Total_Orders field shows the customer’s total order, adding status as canceled and period different from the selected date.

    Would it be possible for the Customer_Total_Orders field to only show according to the selected filter?

    See that I use date and status filters: Screenshot

    I also tried a custom code that I saw here in another post: screenshot

    But the result shows the total of orders regardless of the selected status and the date: screenshot

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    https://uploaddeimagens.com.br/imagens/lPk9wwQ
    so on last screenshot , you want to see “4” ?

    you can count number of exported orders and fill this column at end of export.
    use hook woe_xls_print_footer
    there are some examples at page https://docs.algolplus.com/algol_order_export/format-output/

    but you must use PHPExcel to write/read cells.

    thanks, Alex

    Thread Starter Flávio

    (@fuba182)

    thanks for the feedback @algolplus

    Yes, I wanted to display “4” in Customer_Total_Orders according to the selected filters.

    I thought it was just the implementation of some code in “Custom PHP code to modify output”, more advanced customizations like the one you suggested to me at the moment I can’t.

    If anyone can help. I thank.

    Thanks

    Plugin Author algol.plus

    (@algolplus)

    Hello @fuba182

    Please, add this code to section “Misc Settings”.
    I assume you set “Sort orders by” = _billing_email.
    This code checks column “B” and updates column “G”.
    It’s based on your screenshot.
    thanks, Alex

    add_action( 'woe_xls_print_footer', function ($objPHPExcel,$formatter) {
    	$customer_email = false;
    	$customer_started_at = 0;
    	$customer_orders = 0;
    	for($i=2;$i<=$formatter->last_row;$i++) {
    		$email = $objPHPExcel->getActiveSheet()->getCell('B'.$i)->getValue();
    		if($email != $customer_email) {
    			if($customer_email){
    				for($j=$customer_started_at;$j<$i;$j++)
    					$objPHPExcel->getActiveSheet()->getCell('G'.$j)->setValue($customer_orders);
    			}
    			$customer_email = $email;
    			$customer_orders = 1;
    			$customer_started_at = $i;
    		}
    		else
    			$customer_orders++;
    	}
    
    	if($customer_started_at) {
    		for($j=$customer_started_at;$j<=$formatter->last_row;$j++)
    			$objPHPExcel->getActiveSheet()->getCell('G'.$j)->setValue($customer_orders);
    	}
    }, 10, 2); 
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.