OrderNumber.php
878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace ACA\WC\Column\Order;
use AC;
use ACA\WC\Search;
use ACA\WC\Sorting;
use ACP;
class OrderNumber extends AC\Column implements ACP\Search\Searchable, ACP\ConditionalFormat\Formattable,
ACP\Sorting\Sortable
{
use ACP\ConditionalFormat\ConditionalFormatTrait;
public function __construct()
{
$this->set_type('column-order_number')
->set_label(__('Order Number', 'codepress-admin-columns'))
->set_group('woocommerce');
}
public function get_raw_value($id)
{
$order = wc_get_order($id);
return $order ? $order->get_order_number() : $this->get_empty_char();
}
public function search()
{
return new Search\Order\OrderId();
}
public function sorting()
{
return new Sorting\Order\OrderBy('id');
}
}