Alter summary report
1 2 3 4 5 6 7 8 9 10 11 12 |
//sort by sku add_action('woe_summary_before_output' , function() { uasort($_SESSION['woe_summary_products'], function($a,$b) { if( empty($a['sku']) AND empty($b['sku']) ) return 0; if( empty($a['sku']) ) return 1; if( empty($b['sku']) ) return -1; return strcmp($a['sku'],$b['sku']); }); }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Add column "Total Orders" to "Summary by products" class WOE_Total_Orders_Summary{ function __construct() { add_filter('woe_summary_headers',function ($headers) { $headers[] = "Total Orders"; // just text return $headers; }); add_filter('woe_summary_column_keys',function ($cols) { $cols['count'] = 0; // new key with default value return $cols; }); add_action('woe_summary_products_add_item',function ($key, $item, $order) { $_SESSION['woe_summary_products'][$key]['count'] ++; // add 1 for each order },10,3); } } new WOE_Total_Orders_Summary(); |