diff --git a/readme.txt b/readme.txt index 1f395c1f87a..5d3c8ebfb0d 100644 --- a/readme.txt +++ b/readme.txt @@ -200,6 +200,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Dev - Template - Product archive anchors are now hooked into templates rather than hard coded. * Dev - Template - Added template files for the customer details list in emails. emails/email-customer-details.php * Dev - Template - Revised single variation cart template. Template files now exist for variations, and the cart button will display (disabled) when no selections are made. +* Dev - Template - Made "my orders" columns fully customizable with filters. * Dev - Allow wc_clean to support arrays. * Dev - Added a manual update trigger for checkout. * Dev - Added woocommerce_is_price_filter_active filter to Query class. diff --git a/templates/myaccount/my-orders.php b/templates/myaccount/my-orders.php index a0f7f724853..963108634ae 100644 --- a/templates/myaccount/my-orders.php +++ b/templates/myaccount/my-orders.php @@ -11,16 +11,24 @@ * as little as possible, but it does happen. When this occurs the version of the template file will. * be bumped and the readme will list any important changes. * - * @see http://docs.woothemes.com/document/template-structure/ + * @see http://docs.woothemes.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.3.10 + * @version 2.5.0 */ if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly + exit; } +$my_orders_columns = apply_filters( 'woocommerce_my_account_my_orders_columns', array( + 'order-number' => __( 'Order', 'woocommerce' ), + 'order-date' => __( 'Date', 'woocommerce' ), + 'order-status' => __( 'Status', 'woocommerce' ), + 'order-total' => __( 'Total', 'woocommerce' ), + 'order-actions' => ' ', +) ); + $customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array( 'numberposts' => $order_count, 'meta_key' => '_customer_user', @@ -37,71 +45,73 @@ if ( $customer_orders ) : ?> - - - - -   + $column_name ) : ?> + + - populate( $customer_order ); + + get_item_count(); + ?> + + $column_name ) : ?> + + + - ?> - - - get_order_number(); ?> - - - - - - - get_status() ); ?> - - - get_formatted_order_total(), $item_count ); ?> - - - + + get_order_number(); ?> + - if ( $order->needs_payment() ) { - $actions['pay'] = array( - 'url' => $order->get_checkout_payment_url(), - 'name' => __( 'Pay', 'woocommerce' ) - ); - } + + - if ( in_array( $order->get_status(), apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) { - $actions['cancel'] = array( - 'url' => $order->get_cancel_order_url( wc_get_page_permalink( 'myaccount' ) ), - 'name' => __( 'Cancel', 'woocommerce' ) - ); - } + + get_status() ); ?> - $actions['view'] = array( - 'url' => $order->get_view_order_url(), - 'name' => __( 'View', 'woocommerce' ) - ); + + get_formatted_order_total(), $item_count ); ?> - $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ); + + array( + 'url' => $order->get_checkout_payment_url(), + 'name' => __( 'Pay', 'woocommerce' ) + ), + 'view' => array( + 'url' => $order->get_view_order_url(), + 'name' => __( 'View', 'woocommerce' ) + ), + 'cancel' => array( + 'url' => $order->get_cancel_order_url( wc_get_page_permalink( 'myaccount' ) ), + 'name' => __( 'Cancel', 'woocommerce' ) + ) + ); - if ( $actions ) { - foreach ( $actions as $key => $action ) { - echo '' . esc_html( $action['name'] ) . ''; - } - } - ?> - - + if ( ! $order->needs_payment() ) { + unset( $actions['pay'] ); + } + if ( ! in_array( $order->get_status(), apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) { + unset( $actions['cancel'] ); + } + + if ( $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ) ) { + foreach ( $actions as $key => $action ) { + echo '' . esc_html( $action['name'] ) . ''; + } + } + ?> + + + + + + -