From 91d77c539207bf09a52e1c0717b59ece9ed51bb0 Mon Sep 17 00:00:00 2001 From: Ken Bass Date: Thu, 14 Feb 2013 14:33:47 -0500 Subject: [PATCH] Make my order filters more flexible --- templates/myaccount/my-orders.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/templates/myaccount/my-orders.php b/templates/myaccount/my-orders.php index 40a179b75d4..8b66ecc356f 100644 --- a/templates/myaccount/my-orders.php +++ b/templates/myaccount/my-orders.php @@ -59,23 +59,35 @@ if ( $customer_orders ) : ?> name, 'woocommerce' ) ); ?> - status, array( 'pending', 'failed' ) ) ) : ?> + get_cancel_order_url() ); ?>" class="cancel" title="">() + if ( in_array( $order->status, array( 'pending', 'failed' ) ) ) + $status_actions['cancel'] = array( + 'url' => $order->get_cancel_order_url(), + 'text' => __( 'Cancel', 'woocommerce' ), + 'title' => __( 'Click to cancel this order', 'woocommerce' ), + 'class' => 'cancel' + ); - + $status_actions = apply_filters( 'woocommerce_my_account_my_orders_status_actions', $status_actions, $order ); + + foreach ( $status_actions as $status_action ) { + echo '' . esc_html( $status_action['text'] ) . ''; + } + ?> status, array( 'pending', 'failed' ) ) ) - $actions[] = array( + $actions['pay'] = array( 'url' => $order->get_checkout_payment_url(), 'name' => __( 'Pay', 'woocommerce' ) ); - $actions[] = array( + $actions['view'] = array( 'url' => add_query_arg( 'order', $order->id, get_permalink( woocommerce_get_page_id( 'view_order' ) ) ), 'name' => __( 'View', 'woocommerce' ) ); @@ -83,7 +95,7 @@ if ( $customer_orders ) : ?> $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ); foreach( $actions as $action ) { - echo '' . esc_html( $action['name'] ) . ''; + echo '' . esc_html( $action['name'] ) . ''; } ?>