Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter morgancrow

    (@morgancrow)

    Update for anyone who might need it. This is the working code that adds a blank row after each new seller. Thanks again for the help!

    add_action('woe_summary_before_output' , function() {
         $current_seller = false;
      foreach($_SESSION['woe_summary_products'] as $data) {
        if ($current_seller != $data['Sold By']){
          $new_rows[]=array();
          $current_seller=$data['Sold By'];
        }
        $new_rows[]=$data;
      }
      $_SESSION['woe_summary_products'] = $new_rows;
    });
    • This reply was modified 5 years, 1 month ago by morgancrow.
    Thread Starter morgancrow

    (@morgancrow)

    No worries at all. I can debug, and thanks for taking the time. Would you mind maybe explaining your approach to the logic used in the above code? Thanks again!

    Thread Starter morgancrow

    (@morgancrow)

    Unfortunately your code did not add a blank row after each new vendor, but I will keep tweaking to see if I can get it. Thanks again.

    Thread Starter morgancrow

    (@morgancrow)

    Hello. Pasted are the settings from the Profile I am working on. Thanks for the quick reply!

    {
        "version": "2.0",
        "mode": "profiles",
        "title": "Total Sales - Cash",
        "skip_empty_file": true,
        "log_results": false,
        "from_status": [],
        "to_status": [],
        "change_order_status_to": "",
        "statuses": [],
        "from_date": "2021-04-20",
        "to_date": "2021-04-21",
        "sub_start_from_date": "",
        "sub_start_to_date": "",
        "sub_end_from_date": "",
        "sub_end_to_date": "",
        "sub_next_paym_from_date": "",
        "sub_next_paym_to_date": "",
        "from_order_id": "",
        "to_order_id": "",
        "shipping_locations": [],
        "shipping_methods": [],
        "item_names": [],
        "item_metadata": [],
        "user_roles": [],
        "user_names": [],
        "user_custom_fields": [],
        "billing_locations": [],
        "payment_methods": [
            "cod"
        ],
        "any_coupon_used": "0",
        "coupons": [],
        "order_custom_fields": [],
        "product_categories": [],
        "product_vendors": [],
        "products": [],
        "product_sku": "",
        "exclude_products": [],
        "product_taxonomies": [],
        "product_custom_fields": [],
        "product_attributes": [],
        "product_itemmeta": [],
        "format": "XLS",
        "format_xls_use_xls_format": "0",
        "format_xls_sheet_name": "Orders",
        "format_xls_display_column_names": "1",
        "format_xls_auto_width": "1",
        "format_xls_direction_rtl": "0",
        "format_xls_force_general_format": "0",
        "format_xls_row_images_width": "50",
        "format_xls_row_images_height": "50",
        "format_csv_enclosure": "\"",
        "format_csv_delimiter": ",",
        "format_csv_linebreak": "\\r\\n",
        "format_csv_display_column_names": "1",
        "format_csv_add_utf8_bom": "0",
        "format_csv_item_rows_start_from_new_line": "0",
        "format_csv_encoding": "UTF-8",
        "format_csv_delete_linebreaks": "0",
        "format_tsv_linebreak": "\\r\\n",
        "format_tsv_display_column_names": "1",
        "format_tsv_add_utf8_bom": "0",
        "format_tsv_item_rows_start_from_new_line": "0",
        "format_tsv_encoding": "UTF-8",
        "format_xml_root_tag": "Orders",
        "format_xml_order_tag": "Order",
        "format_xml_product_tag": "Product",
        "format_xml_coupon_tag": "Coupon",
        "format_xml_prepend_raw_xml": "",
        "format_xml_append_raw_xml": "",
        "format_xml_self_closing_tags": "1",
        "format_xml_preview_format": "0",
        "format_json_start_tag": "[",
        "format_json_end_tag": "]",
        "format_json_unescaped_slashes": 0,
        "format_json_numeric_check": 0,
        "format_pdf_display_column_names": "1",
        "format_pdf_repeat_header": "1",
        "format_pdf_direction_rtl": 0,
        "format_pdf_orientation": "L",
        "format_pdf_page_size": "A4",
        "format_pdf_font_size": "8",
        "format_pdf_header_text": "",
        "format_pdf_footer_text": "",
        "format_pdf_pagination": "C",
        "format_pdf_fit_page_width": "0",
        "format_pdf_cols_width": "25",
        "format_pdf_cols_align": "L",
        "format_pdf_cols_vertical_align": "T",
        "format_pdf_page_header_text_color": "#000000",
        "format_pdf_page_footer_text_color": "#000000",
        "format_pdf_table_header_text_color": "#000000",
        "format_pdf_table_header_background_color": "#FFFFFF",
        "format_pdf_table_row_text_color": "#000000",
        "format_pdf_table_row_background_color": "#FFFFFF",
        "format_pdf_logo_source_id": "0",
        "format_pdf_logo_source": "",
        "format_pdf_logo_width": "0",
        "format_pdf_logo_height": "15",
        "format_pdf_logo_align": "R",
        "format_pdf_row_images_width": "15",
        "format_pdf_row_images_height": "15",
        "format_pdf_row_images_add_link": "0",
        "format_pdf_row_dont_page_break_order_lines": "0",
        "format_html_display_column_names": "1",
        "format_html_repeat_header_last_line": "0",
        "format_html_font_size": "13",
        "format_html_header_text": "",
        "format_html_footer_text": "",
        "format_html_cols_align": "L",
        "format_html_header_text_color": "#000000",
        "format_html_footer_text_color": "#000000",
        "format_html_table_header_text_color": "#000000",
        "format_html_table_header_background_color": "#FFFFFF",
        "format_html_table_row_text_color": "#000000",
        "format_html_table_row_background_color": "#FFFFFF",
        "format_html_row_images_width": "100",
        "format_html_row_images_height": "100",
        "format_html_images_add_link": "0",
        "format_html_custom_css": "",
        "all_products_from_order": "0",
        "skip_refunded_items": "0",
        "skip_suborders": "0",
        "export_refunds": "0",
        "export_matched_items": "0",
        "date_format": "Y-m-d",
        "time_format": "H:i",
        "sort_direction": "DESC",
        "sort": "order_id",
        "format_number_fields": "0",
        "export_all_comments": "0",
        "export_refund_notes": "0",
        "strip_tags_product_fields": "0",
        "cleanup_phone": "0",
        "convert_serialized_values": "0",
        "enable_debug": "0",
        "billing_details_for_shipping": "0",
        "custom_php": "1",
        "custom_php_code": "add_filter(\u0027woe_summary_products_headers\u0027,function ($headers) {\r\n                          $headers[] = \"Cost of Goods Subtotal\";\r\n                          $headers[] = \"Profits\";\r\n                          $headers[] = \"Tithe\";\r\n                          $headers[] = \"Payout Amount\";\/\/blank column\r\n\t\t\treturn $headers;\r\n\t\t});\r\nadd_filter(\u0027woe_summary_column_keys\u0027,function ($cols) {\r\n            $cols[\u0027cog_subtotal\u0027]   = 0; \/\/no clue if this will work\r\n            $cols[\u0027profits\u0027]        = 0;\r\n            $cols[\u0027tithe\u0027]          = 0;\r\n            $cols[\u0027payout\u0027] = 0;\r\n               \r\n\t\t\treturn $cols;\r\n\t\t});\r\nadd_action(\u0027woe_summary_products_add_item\u0027,function ($key, $item, $order) {\r\n\/\/cog subtotal\r\n$_SESSION[\u0027woe_summary_products\u0027][$key][\u0027cog_subtotal\u0027] += ($_SESSION[\u0027woe_summary_products\u0027][$key][\u0027_alg_wc_cog_cost\u0027]);\r\n\/\/profits\r\n$_SESSION[\u0027woe_summary_products\u0027][$key][\u0027profits\u0027] += ($_SESSION[\u0027woe_summary_products\u0027][$key][\u0027summary_report_total_amount\u0027] - $_SESSION[\u0027woe_summary_products\u0027][$key][\u0027cog_subtotal\u0027]);\r\n\/\/tithe\r\n$_SESSION[\u0027woe_summary_products\u0027][$key][\u0027tithe\u0027] += (($_SESSION[\u0027woe_summary_products\u0027][$key][\u0027summary_report_total_amount\u0027] - $_SESSION[\u0027woe_summary_products\u0027][$key][\u0027cog_subtotal\u0027])*0.1);\r\n\r\n\/\/payout amount\r\n$_SESSION[\u0027woe_summary_products\u0027][$key][\u0027payout\u0027] += round(($_SESSION[\u0027woe_summary_products\u0027][$key][\u0027summary_report_total_amount\u0027]) - ($_SESSION[\u0027woe_summary_products\u0027][$key][\u0027tithe\u0027]), 2);\r\n\t\t},10,3);\r\n\r\n\t\t\/\/sort by sku\r\nadd_action(\u0027woe_summary_before_output\u0027 , function() {\r\n  uasort($_SESSION[\u0027woe_summary_products\u0027], function($a,$b) {\r\n\tif( empty($a[\u0027Sold By\u0027]) AND empty($b[\u0027Sold By\u0027]) )\r\n\t\treturn 0;\r\n\tif( empty($a[\u0027Sold By\u0027]) )\r\n\t\treturn 1;\r\n\tif( empty($b[\u0027Sold By\u0027]) )\r\n\t\treturn -1;\r\n\treturn strcmp($a[\u0027Sold By\u0027],$b[\u0027Sold By\u0027]);\r\n  });\r\n});\r\n\r\nadd_filter(\"woe_fetch_order_data\", function($rows) {\r\n\t$rows[] = array(\"\");\r\n\treturn $rows;\r\n});",
        "mark_exported_orders": "0",
        "export_unmarked_orders": "0",
        "summary_report_by_products": "1",
        "duplicated_fields_settings": {
            "products": {
                "repeat": "rows",
                "populate_other_columns": "1",
                "max_cols": "10",
                "group_by": "product",
                "line_delimiter": "\\n"
            },
            "coupons": {
                "repeat": "rows",
                "max_cols": "10",
                "group_by": "product",
                "line_delimiter": "\\n"
            }
        },
        "summary_report_by_customers": "0",
        "order_fields": [
            {
                "segment": "common",
                "key": "order_number",
                "label": "Order Number",
                "format": "string",
                "colname": "Order Number"
            },
            {
                "segment": "products",
                "key": "products",
                "colname": "Products",
                "label": "Products",
                "format": "undefined"
            },
            {
                "segment": "products",
                "key": "plain_products_product_name_main",
                "label": "Product Name (main)",
                "format": "string",
                "colname": "Product Name"
            },
            {
                "segment": "products",
                "key": "plain_products_seller",
                "label": "Product Seller",
                "format": "string",
                "colname": "Product Seller"
            },
            {
                "segment": "products",
                "key": "plain_products_Sold By",
                "label": "Sold By",
                "format": "undefined",
                "colname": "Sold By"
            },
            {
                "segment": "products",
                "key": "plain_products_item_price",
                "label": "Item Cost",
                "format": "money",
                "colname": "Item Cost"
            },
            {
                "segment": "products",
                "key": "plain_products__alg_wc_cog_cost",
                "label": "_alg_wc_cog_cost",
                "format": "",
                "colname": "Cost of Goods"
            },
            {
                "segment": "user",
                "key": "plain_orders_USER_last_name",
                "label": "USER_last_name",
                "format": "",
                "colname": "USER_last_name"
            },
            {
                "segment": "user",
                "key": "plain_orders_USER_first_name",
                "label": "USER_first_name",
                "format": "",
                "colname": "USER_first_name"
            },
            {
                "segment": "cart",
                "key": "payment_method_title",
                "label": "Payment Method Title",
                "format": "string",
                "colname": "Payment Method Title"
            },
            {
                "segment": "common",
                "key": "order_date",
                "label": "Order Date",
                "format": "date",
                "colname": "Order Date"
            },
            {
                "segment": "coupons",
                "key": "coupons",
                "colname": "Coupons",
                "label": "Coupons",
                "format": "undefined"
            },
            {
                "segment": "coupons",
                "key": "plain_coupons_discount_amount",
                "label": "Discount Amount",
                "format": "money",
                "colname": "Discount Amount"
            },
            {
                "segment": "totals",
                "key": "order_refund",
                "label": "Order Refund Amount",
                "format": "money",
                "colname": "Order Refund Amount"
            },
            {
                "segment": "cart",
                "key": "order_subtotal",
                "label": "Order Subtotal Amount",
                "format": "money",
                "colname": "Order Subtotal Amount"
            },
            {
                "segment": "totals",
                "key": "order_total_tax",
                "label": "Order Total Tax Amount",
                "format": "money",
                "colname": "Order Total Tax Amount"
            },
            {
                "segment": "totals",
                "key": "order_total",
                "label": "Order Total Amount",
                "format": "money",
                "colname": "Order Total Amount"
            },
            {
                "segment": "products",
                "key": "plain_products_summary_report_total_qty",
                "label": "Summary Report Total Quantity",
                "format": "number",
                "colname": "Total Quantity"
            },
            {
                "segment": "products",
                "key": "plain_products_summary_report_total_discount",
                "label": "Summary Report Total Discount",
                "format": "money",
                "colname": "Total Discount"
            },
            {
                "segment": "products",
                "key": "plain_products_summary_report_total_refund_count",
                "label": "Summary Report Total Refund Count",
                "format": "number",
                "colname": "Total Refund Count"
            },
            {
                "segment": "products",
                "key": "plain_products_summary_report_total_refund_amount",
                "label": "Summary Report Total Refund Amount",
                "format": "money",
                "colname": "Total Refund Amount"
            },
            {
                "segment": "products",
                "key": "plain_products_summary_report_total_amount",
                "label": "Summary Report Total Amount",
                "format": "money",
                "colname": "Total Sales"
            }
        ],
        "order_product_fields": [
            {
                "label": "SKU",
                "format": "string",
                "colname": "SKU",
                "default": 1,
                "key": "sku"
            },
            {
                "label": "Item #",
                "format": "number",
                "colname": "Item #",
                "default": 1,
                "key": "line_id"
            },
            {
                "label": "Item Name",
                "format": "string",
                "colname": "Item Name",
                "default": 1,
                "key": "name"
            },
            {
                "label": "Quantity",
                "format": "number",
                "colname": "Quantity",
                "default": 1,
                "key": "qty"
            },
            {
                "label": "Item Cost",
                "format": "money",
                "colname": "Item Cost",
                "default": 1,
                "key": "item_price"
            }
        ],
        "order_coupon_fields": [
            {
                "label": "Coupon Code",
                "format": "string",
                "colname": "Coupon Code",
                "default": 1,
                "key": "code"
            },
            {
                "label": "Discount Amount",
                "format": "money",
                "colname": "Discount Amount",
                "default": 1,
                "key": "discount_amount"
            },
            {
                "label": "Discount Amount Tax",
                "format": "money",
                "colname": "Discount Amount Tax",
                "default": 1,
                "key": "discount_amount_tax"
            }
        ],
        "id": 5,
        "post_type": "shop_order",
        "export_rule_field": "date",
        "export_filename": "orders-%y-%m-%d-%h-%i-%s.xlsx"
    }
    Thread Starter morgancrow

    (@morgancrow)

    I am also wondering if there are options to fill cells with colors. Thank you again!

Viewing 5 replies - 1 through 5 (of 5 total)