TransactionId.php
1.04 KB
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
41
42
43
44
45
46
47
48
<?php
namespace ACA\WC\Column\Order;
use AC;
use ACA\WC;
use ACP;
class TransactionId extends AC\Column implements ACP\Search\Searchable, ACP\Export\Exportable,
ACP\ConditionalFormat\Formattable, ACP\Sorting\Sortable
{
use ACP\ConditionalFormat\ConditionalFormatTrait;
public function __construct()
{
$this->set_type('column-order_transaction_id')
->set_label(__('Transaction ID', 'woocommerce'))
->set_group('woocommerce');
}
public function get_value($id)
{
$order = wc_get_order($id);
$transaction_id = $order
? $order->get_transaction_id()
: false;
return $transaction_id ?: $this->get_empty_char();
}
public function search()
{
return new WC\Search\Order\TransactionId();
}
public function export()
{
return new ACP\Export\Model\Value($this);
}
public function sorting()
{
return new WC\Sorting\Order\OrderData('transaction_id');
}
}