Forum Replies Created

Viewing 15 replies - 16 through 30 (of 5,788 total)
  • Plugin Author algol.plus

    (@algolplus)

    You’re welcome

    Plugin Author algol.plus

    (@algolplus)

    please, open section “Misc Settings”(at bottom) and add this code

    // export only orders with total > 0
    add_filter( 'woe_order_export_started', function ( $order_id ) {
    $order = new WC_Order($order_id);
    return ($order->get_total() > 0.00) ? $order_id: false;
    });

    • This reply was modified 1 year, 4 months ago by algol.plus.
    Plugin Author algol.plus

    (@algolplus)

    1. How can we implement the same but clients as columns and products as rows instead?
      Please, mark checkbox ‘Summary report by products’ and add this code to “Misc Settings”.
      version for CSV format
    //Version for CSV !

    //Save header to array , don't print now !
    add_filter( "woe_csv_header_filter", function($data ){
    $_SESSION['woe_summary_products_header'] = $data;
    return [];
    });

    //Record customers for product
    add_action( "woe_summary_products_add_item", function ($key, $product_item, $order, $item ) {
    //gather names
    $name = $order->get_billing_first_name() . " " . $order->get_billing_last_name();
    if( empty($_SESSION['woe_summary_products'][$key]['customer-names']) )
    $_SESSION['woe_summary_products'][$key]['customer-names'] = array();
    //and qty
    $_SESSION['woe_summary_products'][$key]['customer-names'][] = $name;
    if( empty($_SESSION['woe_summary_products'][$key][$name]) )
    $_SESSION['woe_summary_products'][$key][$name] = 0;
    $_SESSION['woe_summary_products'][$key][$name] += $product_item['qty'];
    },10,4);

    //Rebuild product summary rows
    add_action( 'woe_summary_before_output', function(){
    //get customers
    $names = array();
    foreach($_SESSION['woe_summary_products'] as $data){
    $names = array_merge($names, $data['customer-names']);
    }
    $names = array_unique($names);
    sort($names);
    $woe_summary_products_headers_extra = $names;

    //rebuild rows
    foreach($_SESSION['woe_summary_products'] as $key=>$data){
    $new_row = $data;
    foreach($names as $name) {
    if( !isset($new_row[$name]) )//no data
    $new_row[$name.'-qty'] = "";
    else {//move to correct column
    $new_row[$name.'-qty'] = $new_row[$name];
    unset($new_row[$name]);
    }
    }
    unset($new_row['customer-names']);
    //move field summary_report_total_qty at end $new_row
    $value = $new_row['summary_report_total_qty'];
    unset($new_row['summary_report_total_qty']);
    $new_row['summary_report_total_qty'] = $value;
    $_SESSION['woe_summary_products'][$key] = $new_row;
    }

    //make new header now
    $row =$_SESSION['woe_summary_products_header'];
    $pos = array_search("Summary Report Total Quantity", $row);
    if($pos!==false) unset($row[$pos]);
    $row = array_merge($row, $woe_summary_products_headers_extra,["Summary Report Total Quantity"]);
    array_unshift($_SESSION['woe_summary_products'],$row);
    });

    Plugin Author algol.plus

    (@algolplus)

    1) But you already have products in column Fridge ?
    Please, show required changes on the screenshot too.

    2) try add this code to “Misc Settings”
    add_action( 'woe_xls_print_header', function ($objXls,$formatter) {
    $objXls->getActiveSheet()->getDefaultRowDimension()->setRowHeight(-1);
    }, 10, 2);

    Plugin Author algol.plus

    (@algolplus)

    Hello

    Please open section Setup Fields and set “Fill order details” = “1st row only”.

    Plugin Author algol.plus

    (@algolplus)

    Hello

    Do you want to add new column ?
    And fill this column based on item meta?
    Please, use this way https://docs.algolplus.com/algol_order_export/add-calculated-field-for-product/

    If I mistaken — share screenshot of order items and rephrase the question.

    Plugin Author algol.plus

    (@algolplus)

    Hello

    WooCommerce Subscriptions is complex plugin.

    So we modify costs only once , when inital order placed (and new subscription created).
    We don’t change anything in renewal orders, they created by “WooCommerce Subscriptions” based on existing subscription.

    Plugin Author algol.plus

    (@algolplus)

    You’re welcome

    Plugin Author algol.plus

    (@algolplus)

    Hello

    We fill this dropdown based on existing orders.

    Please, create 2 fake orders (for these countries), wait 5 minutes and reload page with our plugin.

    Plugin Author algol.plus

    (@algolplus)

    hello

    Our plugin correctly works with HPOS mode, nobody reported similar problem in past.

    What WooCommerce version do you use?

    Plugin Author algol.plus

    (@algolplus)

    2. I updated 2nd code (for CSV) at page https://docs.algolplus.com/algol_order_export/export-products-as-columns/

    You must uncomment line 82!

    Plugin Author algol.plus

    (@algolplus)

    1. How can we make the ‘Summary Report Total Quantity’ column to display last, after the clients columns?

    //Record customers for product
    add_action( "woe_summary_products_add_item", function ($key, $product_item, $order, $item ) {
    //gather names
    $name = $order->get_billing_first_name() . " " . $order->get_billing_last_name();
    if( empty($_SESSION['woe_summary_products'][$key]['customer-names']) )
    $_SESSION['woe_summary_products'][$key]['customer-names'] = array();
    //and qty
    $_SESSION['woe_summary_products'][$key]['customer-names'][] = $name;
    if( empty($_SESSION['woe_summary_products'][$key][$name]) )
    $_SESSION['woe_summary_products'][$key][$name] = 0;
    $_SESSION['woe_summary_products'][$key][$name] += $product_item['qty'];
    },10,4);

    //Rebuild product summary rows
    add_action( 'woe_summary_before_output', function(){
    global $woe_summary_products_headers_extra;
    //get customers
    $names = array();
    foreach($_SESSION['woe_summary_products'] as $data){
    $names = array_merge($names, $data['customer-names']);
    }
    $names = array_unique($names);
    sort($names);
    $woe_summary_products_headers_extra = $names;

    //rebuild rows
    foreach($_SESSION['woe_summary_products'] as $key=>$data){
    $new_row = $data;
    foreach($names as $name) {
    if( !isset($new_row[$name]) )//no data
    $new_row[$name.'-qty'] = "";
    else {//move to correct column
    $new_row[$name.'-qty'] = $new_row[$name];
    unset($new_row[$name]);
    }
    }
    unset($new_row['customer-names']);
    //move field summary_report_total_qty at end $new_row
    $value = $new_row['summary_report_total_qty'];
    unset($new_row['summary_report_total_qty']);
    $new_row['summary_report_total_qty'] = $value;
    $_SESSION['woe_summary_products'][$key] = $new_row;
    }
    });

    //Add customers to header
    add_filter('woe_xls_header_filter_final', function($row){
    global $woe_summary_products_headers_extra;
    $pos = array_search("Summary Report Total Quantity", $row);
    if($pos!==false) unset($row[$pos]);
    $row = array_merge($row, $woe_summary_products_headers_extra,["Summary Report Total Quantity"]);
    return $row;
    });

    Plugin Author algol.plus

    (@algolplus)

    1. How can we implement the same but clients as columns and products as rows instead?

    Please, mark checkbox ‘Summary report by products’ and add this code to “Misc Settings”

    //Record customers for product
    add_action( "woe_summary_products_add_item", function ($key, $product_item, $order, $item ) {
    //gather names
    $name = $order->get_billing_first_name() . " " . $order->get_billing_last_name();
    if( empty($_SESSION['woe_summary_products'][$key]['customer-names']) )
    $_SESSION['woe_summary_products'][$key]['customer-names'] = array();
    //and qty
    $_SESSION['woe_summary_products'][$key]['customer-names'][] = $name;
    if( empty($_SESSION['woe_summary_products'][$key][$name]) )
    $_SESSION['woe_summary_products'][$key][$name] = 0;
    $_SESSION['woe_summary_products'][$key][$name] += $product_item['qty'];
    },10,4);

    //Rebuild product summary rows
    add_action( 'woe_summary_before_output', function(){
    global $woe_summary_products_headers_extra;
    //get customers
    $names = array();
    foreach($_SESSION['woe_summary_products'] as $data){
    $names = array_merge($names, $data['customer-names']);
    }
    $names = array_unique($names);
    sort($names);
    $woe_summary_products_headers_extra = $names;

    //rebuild rows
    foreach($_SESSION['woe_summary_products'] as $key=>$data){
    $new_row = $data;
    foreach($names as $name) {
    if( !isset($new_row[$name]) )//no data
    $new_row[$name.'-qty'] = "";
    else {//move to correct column
    $new_row[$name.'-qty'] = $new_row[$name];
    unset($new_row[$name]);
    }
    }
    unset($new_row['customer-names']);
    $_SESSION['woe_summary_products'][$key] = $new_row;
    }
    });

    //Add customers to header
    add_filter('woe_xls_header_filter_final', function($row){
    global $woe_summary_products_headers_extra;
    $row = array_merge($row, $woe_summary_products_headers_extra);
    return $row;
    });

    Plugin Author algol.plus

    (@algolplus)

    2. Do you use code https://docs.algolplus.com/algol_order_export/export-products-as-columns/ ?

    please replace last function with this version

    //4
    function analyze_products_add_columns($phpExcel,$formatter) {
        // add products as titles
        foreach($this->product_columns as $pos=>$text){
            $formatter->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow( $pos+$this->headers_added, 1, $text );
            //add formulas for total
            $L = PHPExcel_Cell::stringFromColumnIndex($pos + $this->headers_added);
            $row = $formatter->last_row;
            $formatter->objPHPExcel->getActiveSheet()->setCellValue( $L. ($row+1), "=SUM({$L}2:{$L}$row)");
        }
        //make first bold
        $last_column = $formatter->objPHPExcel->getActiveSheet()->getHighestDataColumn();
        $formatter->objPHPExcel->getActiveSheet()->getStyle( "A1:" . $last_column . "1" )->getFont()->setBold( true );
    }
    Plugin Author algol.plus

    (@algolplus)

    Hello

    What theme do you use ?

    if you use paid theme — submit it (zip file) as new ticket to https://algolplus.freshdesk.com/

Viewing 15 replies - 16 through 30 (of 5,788 total)