WC_Admin_Log_Table_List::prepare_items()publicWC 1.0

Prepare table list items.

Метод класса: WC_Admin_Log_Table_List{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Admin_Log_Table_List = new WC_Admin_Log_Table_List();
$WC_Admin_Log_Table_List->prepare_items();

Заметки

  • Global. wpdb. $wpdb

Код WC_Admin_Log_Table_List::prepare_items() WC 8.7.0

public function prepare_items() {
	global $wpdb;

	$this->prepare_column_headers();

	$per_page = $this->get_items_per_page(
		self::PER_PAGE_USER_OPTION_KEY,
		$this->get_per_page_default()
	);

	$where  = $this->get_items_query_where();
	$order  = $this->get_items_query_order();
	$limit  = $this->get_items_query_limit();
	$offset = $this->get_items_query_offset();

	$query_items = "
		SELECT log_id, timestamp, level, message, source, context
		FROM {$wpdb->prefix}woocommerce_log
		{$where} {$order} {$limit} {$offset}
	";

	$this->items = $wpdb->get_results( $query_items, ARRAY_A );

	$query_count = "SELECT COUNT(log_id) FROM {$wpdb->prefix}woocommerce_log {$where}";
	$total_items = $wpdb->get_var( $query_count );

	$this->set_pagination_args(
		array(
			'total_items' => $total_items,
			'per_page'    => $per_page,
			'total_pages' => ceil( $total_items / $per_page ),
		)
	);
}