Orders::prepare_items()
Prepares the list of items for displaying.
Source
File: src/Tickets/Commerce/Admin_Tables/Orders.php
public function prepare_items() {
$post_id = tribe_get_request_var( 'post_id', 0 );
$post_id = tribe_get_request_var( 'event_id', $post_id );
$this->post_id = $post_id;
$product_ids = tribe_get_request_var( 'product_ids' );
$product_ids = ! empty( $product_ids ) ? explode( ',', $product_ids ) : null;
$search = tribe_get_request_var( 's' );
$page = absint( tribe_get_request_var( 'paged', 0 ) );
$arguments = [
'status' => 'any',
'paged' => $page,
'posts_per_page' => $this->per_page_option,
];
if ( $search ) {
$arguments['search'] = $search;
}
if ( ! empty( $post_id ) ) {
$arguments['events'] = $post_id;
}
if ( ! empty( $product_ids ) ) {
$arguments['tickets'] = $product_ids;
}
$orders_repository = tec_tc_orders()->by_args( $arguments );
$total_items = $orders_repository->found();
$this->items = $orders_repository->all();
$this->set_pagination_args( [
'total_items' => $total_items,
'per_page' => $this->per_page_option,
] );
}
Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |