Add descriptive comments
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Wiaas_Admin_CL_Orders
|
||||
*/
|
||||
class Wiaas_Admin_CL_Orders {
|
||||
|
||||
/**
|
||||
* Displays list of orders from commercial lead owned shop
|
||||
*
|
||||
* Enables quick preview of each order
|
||||
*
|
||||
* This list of orders is achieved with customization of default order list for `shop_order` post
|
||||
* by using hooks and filters to allow only data that commercial lead should be able to see
|
||||
*
|
||||
*/
|
||||
|
||||
public static function init() {
|
||||
|
||||
add_filter( 'bulk_actions-edit-shop_order', array( __CLASS__, 'remove_bulk_actions_for_list_table_orders' ), 999 );
|
||||
@@ -15,27 +28,35 @@ class Wiaas_Admin_CL_Orders {
|
||||
add_filter( 'manage_edit-shop_order_sortable_columns', array( __CLASS__, 'define_sortable_columns_for_list_table_orders' ) );
|
||||
|
||||
add_action('manage_shop_order_posts_custom_column', array(__CLASS__, 'render_columns_for_list_table_orders'), 999, 2);
|
||||
|
||||
//add_filter('wc_order_types', array(__CLASS__, ''), 999, 32);
|
||||
}
|
||||
|
||||
public static function hide_order_customers_search( $order_types, $for ) {
|
||||
|
||||
if ($for === 'order-meta-boxes') {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $order_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all bulk actions for commercial lead
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function remove_bulk_actions_for_list_table_orders() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove actions from shop order preview modal so only data info is visible
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function remove_actions_from_order_preview() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show only packages on order preview
|
||||
*
|
||||
* @param $order_items
|
||||
* @param $order
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function filter_order_items_for_order_preview($order_items, $order) {
|
||||
|
||||
$items = array();
|
||||
@@ -49,6 +70,13 @@ class Wiaas_Admin_CL_Orders {
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override default table columns so only commercial lead specific columns are visible
|
||||
*
|
||||
* @param $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function columns_for_list_table_orders($columns) {
|
||||
$show_columns = array();
|
||||
$show_columns['cb'] = $columns['cb'];
|
||||
@@ -61,6 +89,12 @@ class Wiaas_Admin_CL_Orders {
|
||||
}
|
||||
|
||||
|
||||
/** Append commercial lead columns to table sortable columns
|
||||
*
|
||||
* @param $sortable_columns
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function define_sortable_columns_for_list_table_orders($sortable_columns) {
|
||||
|
||||
$sortable_columns['_wiaas_order_number'] = 'ID';
|
||||
@@ -68,6 +102,12 @@ class Wiaas_Admin_CL_Orders {
|
||||
return $sortable_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render commercial lead specific columns
|
||||
*
|
||||
* @param $column
|
||||
* @param $order_id
|
||||
*/
|
||||
public static function render_columns_for_list_table_orders($column, $order_id) {
|
||||
|
||||
if ($column === '_wiaas_order_number') {
|
||||
|
||||
Reference in New Issue
Block a user