| @@ 43-102 (lines=60) @@ | ||
| 40 | </thead> |
|
| 41 | ||
| 42 | <tbody> |
|
| 43 | <?php foreach ( $customer_orders as $customer_order ) : |
|
| 44 | $order = wc_get_order( $customer_order ); |
|
| 45 | $item_count = $order->get_item_count(); |
|
| 46 | ?> |
|
| 47 | <tr class="order"> |
|
| 48 | <?php foreach ( $my_orders_columns as $column_id => $column_name ) : ?> |
|
| 49 | <td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>"> |
|
| 50 | <?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?> |
|
| 51 | <?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?> |
|
| 52 | ||
| 53 | <?php elseif ( 'order-number' === $column_id ) : ?> |
|
| 54 | <a href="<?php echo esc_url( $order->get_view_order_url() ); ?>"> |
|
| 55 | <?php echo _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number(); ?> |
|
| 56 | </a> |
|
| 57 | ||
| 58 | <?php elseif ( 'order-date' === $column_id ) : ?> |
|
| 59 | <time datetime="<?php echo date( 'Y-m-d', strtotime( $order->order_date ) ); ?>" title="<?php echo esc_attr( strtotime( $order->order_date ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></time> |
|
| 60 | ||
| 61 | <?php elseif ( 'order-status' === $column_id ) : ?> |
|
| 62 | <?php echo wc_get_order_status_name( $order->get_status() ); ?> |
|
| 63 | ||
| 64 | <?php elseif ( 'order-total' === $column_id ) : ?> |
|
| 65 | <?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); ?> |
|
| 66 | ||
| 67 | <?php elseif ( 'order-actions' === $column_id ) : ?> |
|
| 68 | <?php |
|
| 69 | $actions = array( |
|
| 70 | 'pay' => array( |
|
| 71 | 'url' => $order->get_checkout_payment_url(), |
|
| 72 | 'name' => __( 'Pay', 'woocommerce' ) |
|
| 73 | ), |
|
| 74 | 'view' => array( |
|
| 75 | 'url' => $order->get_view_order_url(), |
|
| 76 | 'name' => __( 'View', 'woocommerce' ) |
|
| 77 | ), |
|
| 78 | 'cancel' => array( |
|
| 79 | 'url' => $order->get_cancel_order_url( wc_get_page_permalink( 'myaccount' ) ), |
|
| 80 | 'name' => __( 'Cancel', 'woocommerce' ) |
|
| 81 | ) |
|
| 82 | ); |
|
| 83 | ||
| 84 | if ( ! $order->needs_payment() ) { |
|
| 85 | unset( $actions['pay'] ); |
|
| 86 | } |
|
| 87 | ||
| 88 | if ( ! in_array( $order->get_status(), apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) { |
|
| 89 | unset( $actions['cancel'] ); |
|
| 90 | } |
|
| 91 | ||
| 92 | if ( $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ) ) { |
|
| 93 | foreach ( $actions as $key => $action ) { |
|
| 94 | echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>'; |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ?> |
|
| 98 | <?php endif; ?> |
|
| 99 | </td> |
|
| 100 | <?php endforeach; ?> |
|
| 101 | </tr> |
|
| 102 | <?php endforeach; ?> |
|
| 103 | </tbody> |
|
| 104 | </table> |
|
| 105 | <?php endif; ?> |
|
| @@ 39-98 (lines=60) @@ | ||
| 36 | </thead> |
|
| 37 | ||
| 38 | <tbody> |
|
| 39 | <?php foreach ( $customer_orders->orders as $customer_order ) : |
|
| 40 | $order = wc_get_order( $customer_order ); |
|
| 41 | $item_count = $order->get_item_count(); |
|
| 42 | ?> |
|
| 43 | <tr class="order"> |
|
| 44 | <?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?> |
|
| 45 | <td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>"> |
|
| 46 | <?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?> |
|
| 47 | <?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?> |
|
| 48 | ||
| 49 | <?php elseif ( 'order-number' === $column_id ) : ?> |
|
| 50 | <a href="<?php echo esc_url( $order->get_view_order_url() ); ?>"> |
|
| 51 | <?php echo _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number(); ?> |
|
| 52 | </a> |
|
| 53 | ||
| 54 | <?php elseif ( 'order-date' === $column_id ) : ?> |
|
| 55 | <time datetime="<?php echo date( 'Y-m-d', strtotime( $order->order_date ) ); ?>" title="<?php echo esc_attr( strtotime( $order->order_date ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></time> |
|
| 56 | ||
| 57 | <?php elseif ( 'order-status' === $column_id ) : ?> |
|
| 58 | <?php echo wc_get_order_status_name( $order->get_status() ); ?> |
|
| 59 | ||
| 60 | <?php elseif ( 'order-total' === $column_id ) : ?> |
|
| 61 | <?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); ?> |
|
| 62 | ||
| 63 | <?php elseif ( 'order-actions' === $column_id ) : ?> |
|
| 64 | <?php |
|
| 65 | $actions = array( |
|
| 66 | 'pay' => array( |
|
| 67 | 'url' => $order->get_checkout_payment_url(), |
|
| 68 | 'name' => __( 'Pay', 'woocommerce' ) |
|
| 69 | ), |
|
| 70 | 'view' => array( |
|
| 71 | 'url' => $order->get_view_order_url(), |
|
| 72 | 'name' => __( 'View', 'woocommerce' ) |
|
| 73 | ), |
|
| 74 | 'cancel' => array( |
|
| 75 | 'url' => $order->get_cancel_order_url( wc_get_page_permalink( 'myaccount' ) ), |
|
| 76 | 'name' => __( 'Cancel', 'woocommerce' ) |
|
| 77 | ) |
|
| 78 | ); |
|
| 79 | ||
| 80 | if ( ! $order->needs_payment() ) { |
|
| 81 | unset( $actions['pay'] ); |
|
| 82 | } |
|
| 83 | ||
| 84 | if ( ! in_array( $order->get_status(), apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ), $order ) ) ) { |
|
| 85 | unset( $actions['cancel'] ); |
|
| 86 | } |
|
| 87 | ||
| 88 | if ( $actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order ) ) { |
|
| 89 | foreach ( $actions as $key => $action ) { |
|
| 90 | echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>'; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ?> |
|
| 94 | <?php endif; ?> |
|
| 95 | </td> |
|
| 96 | <?php endforeach; ?> |
|
| 97 | </tr> |
|
| 98 | <?php endforeach; ?> |
|
| 99 | </tbody> |
|
| 100 | </table> |
|
| 101 | ||