first we need to modify two scripts, one for the backend, other for the frontend, lets start with the backend
1-)inside /wp-content/plugins/woocommerce-openpos/includes/admin/Admin.php, stock_products() function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
//custom fields - by ahmad naser $product_cost = get_post_meta($product_id, '_op_cost_price', true); $product_profit_signle = $price - $product_cost; $product_profit = "(". $product_profit_signle.") - {".($tmp['total_qty'] * $product_profit_signle)."}" ; $product_capital = $tmp['total_qty'] * $product_cost ; $tmp['product_cost'] = $product_cost; $tmp['product_profit'] = $product_profit; $tmp['product_capital'] = $product_capital; $rows[] = apply_filters('op_warehouse_stock_row_data',$tmp,$post,$warehouse_id); |
2-We need to modify the view, for the page wp-admin/admin.php?page=op-stock, so the needed file is /www/wwwroot/nadaalazhar.com/wp-content/plugins/woocommerce-openpos/templates/admin/stock.php
1 2 3 4 5 6 |
<!-- Custom Columns--> <th data-column-id="product_cost" data-sortable="false">التكلفة</th> <th data-column-id="product_profit" data-sortable="false">هامش الربح</th> <th data-column-id="product_capital" data-sortable="false">راس المال </th> <!-- /Custom Columns--> <th data-column-id="action" data-sortable="false" style="text-align: center"><?php echo __( 'Action', 'openpos' ); ?></th> |
That is it :), the end result as following:
in order to search file system, you might use
1 |
find ./ -type f -exec grep -H 'op_stock_products' {} \; |