| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | * This template can be overridden by copying it to yourtheme/learnpress/orders/list.php. |
| 6 | 6 | * |
| 7 | 7 | * @author ThimPress |
| 8 | 8 | * @package Learnpress/Templates |
| 9 | - * @version 4.0.2 | |
| 9 | + * @version 4.0.3 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | use LearnPress\Helpers\Template; |
| 13 | 13 | |
| @@ -23,81 +23,98 @@ | ||
| 23 | 23 | ?> |
| 24 | 24 | |
| 25 | 25 | <h3 class="profile-heading"><?php esc_html_e( 'My Orders', 'learnpress' ); ?></h3> |
| 26 | 26 | |
| 27 | -<table class="lp-list-table profile-list-orders profile-list-table"> | |
| 28 | - <thead> | |
| 29 | - <tr class="order-row"> | |
| 30 | - <th class="column-order-number"><?php esc_html_e( 'Order', 'learnpress' ); ?></th> | |
| 31 | - <th class="column-order-total"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 32 | - <th class="column-order-status"><?php esc_html_e( 'Status', 'learnpress' ); ?></th> | |
| 33 | - <th class="column-order-date"><?php esc_html_e( 'Date', 'learnpress' ); ?></th> | |
| 34 | - <th class="column-order-actions"><?php esc_html_e( 'Actions', 'learnpress' ); ?></th> | |
| 35 | - </tr> | |
| 36 | - </thead> | |
| 27 | +<div class="lp-table-wrap"> | |
| 28 | + <table class="lp-list-table profile-list-orders profile-list-table"> | |
| 29 | + <thead> | |
| 30 | + <tr class="order-row"> | |
| 31 | + <th class="column-order-number"><?php esc_html_e( 'Order', 'learnpress' ); ?></th> | |
| 32 | + <th class="column-order-total"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> | |
| 33 | + <th class="column-order-status"><?php esc_html_e( 'Status', 'learnpress' ); ?></th> | |
| 34 | + <th class="column-order-date"><?php esc_html_e( 'Date', 'learnpress' ); ?></th> | |
| 35 | + <th class="column-order-actions"><?php esc_html_e( 'Actions', 'learnpress' ); ?></th> | |
| 36 | + </tr> | |
| 37 | + </thead> | |
| 37 | 38 | |
| 38 | - <tbody> | |
| 39 | - <?php | |
| 40 | - foreach ( $query_orders->get_items() as $order_id ) { | |
| 41 | - $order = learn_press_get_order( $order_id ); | |
| 42 | - ?> | |
| 39 | + <tbody> | |
| 40 | + <?php | |
| 41 | + foreach ( $query_orders->get_items() as $order_id ) { | |
| 42 | + $order = learn_press_get_order( $order_id ); | |
| 43 | + ?> | |
| 43 | 44 | |
| 44 | - <tr class="order-row"> | |
| 45 | - <td class="column-order-number"> | |
| 46 | - <a href="<?php echo esc_html( $order->get_view_order_url() ); ?>"> | |
| 47 | - <?php echo esc_html( $order->get_order_number() ); ?> | |
| 48 | - </a> | |
| 49 | - </td> | |
| 50 | - <td class="column-order-total"><?php echo esc_html( $order->get_formatted_order_total() ); ?></td> | |
| 51 | - <td class="column-order-status"> | |
| 52 | - <span class="lp-label label-<?php echo esc_attr( $order->get_status() ); ?>"> | |
| 53 | - <?php echo wp_kses_post( $order->get_order_status_html() ); ?> | |
| 54 | - </span> | |
| 55 | - </td> | |
| 56 | - <td class="column-order-date"><?php echo esc_html( $order->get_order_date() ); ?></td> | |
| 57 | - <td class="column-order-actions"> | |
| 58 | - <?php | |
| 59 | - $actions = $order->get_profile_order_actions(); | |
| 45 | + <tr class="order-row"> | |
| 46 | + <td class="column-order-number"> | |
| 47 | + <a href="<?php echo esc_html( $order->get_view_order_url() ); ?>"> | |
| 48 | + <?php echo esc_html( $order->get_order_number() ); ?> | |
| 49 | + </a> | |
| 50 | + </td> | |
| 51 | + <td class="column-order-total"><?php echo esc_html( $order->get_formatted_order_total() ); ?></td> | |
| 52 | + <td class="column-order-status"> | |
| 53 | + <span class="lp-label label-<?php echo esc_attr( $order->get_status() ); ?>"> | |
| 54 | + <?php echo wp_kses_post( $order->get_order_status_html() ); ?> | |
| 55 | + </span> | |
| 56 | + </td> | |
| 57 | + <td class="column-order-date"><?php echo esc_html( $order->get_order_date() ); ?></td> | |
| 58 | + <td class="column-order-actions"> | |
| 59 | + <?php | |
| 60 | + $actions = $order->get_profile_order_actions(); | |
| 60 | 61 | |
| 61 | - if ( $actions ) { | |
| 62 | - foreach ( $actions as $action ) { | |
| 63 | - $action_text = isset( $action['text'] ) ? (string) $action['text'] : ''; | |
| 64 | - $action_url = isset( $action['url'] ) ? (string) $action['url'] : ''; | |
| 65 | - $action_class = isset( $action['class'] ) ? (string) $action['class'] : ''; | |
| 66 | - $action_data_attrs = ''; | |
| 62 | + if ( $actions ) { | |
| 63 | + foreach ( $actions as $action ) { | |
| 64 | + $action_text = isset( $action['text'] ) ? (string) $action['text'] : ''; | |
| 65 | + $action_url = isset( $action['url'] ) ? (string) $action['url'] : ''; | |
| 66 | + $action_class = isset( $action['class'] ) ? (string) $action['class'] : ''; | |
| 67 | + $action_data_attrs = ''; | |
| 67 | 68 | |
| 68 | - if ( ! empty( $action['data'] ) && is_array( $action['data'] ) ) { | |
| 69 | - foreach ( $action['data'] as $data_key => $data_value ) { | |
| 70 | - $action_data_attrs .= sprintf( | |
| 71 | - ' data-%1$s="%2$s"', | |
| 72 | - esc_attr( str_replace( '_', '-', (string) $data_key ) ), | |
| 73 | - esc_attr( (string) $data_value ) | |
| 74 | - ); | |
| 69 | + if ( ! empty( $action['data'] ) && is_array( $action['data'] ) ) { | |
| 70 | + foreach ( $action['data'] as $data_key => $data_value ) { | |
| 71 | + $action_data_attrs .= sprintf( | |
| 72 | + ' data-%1$s="%2$s"', | |
| 73 | + esc_attr( str_replace( '_', '-', (string) $data_key ) ), | |
| 74 | + esc_attr( (string) $data_value ) | |
| 75 | + ); | |
| 76 | + } | |
| 75 | 77 | } |
| 76 | - } | |
| 77 | 78 | |
| 78 | - $action_attrs = ''; | |
| 79 | - if ( ! empty( $action_class ) ) { | |
| 80 | - $action_attrs .= sprintf( ' class="%s"', esc_attr( $action_class ) ); | |
| 81 | - } | |
| 82 | - $action_attrs .= $action_data_attrs; | |
| 79 | + $action_attrs = ''; | |
| 80 | + if ( ! empty( $action_class ) ) { | |
| 81 | + $action_attrs .= sprintf( ' class="%s"', esc_attr( $action_class ) ); | |
| 82 | + } | |
| 83 | + $action_attrs .= $action_data_attrs; | |
| 83 | 84 | |
| 84 | - if ( ! empty( $action_url ) ) { | |
| 85 | - printf( '<a href="%s"%s>%s</a>', esc_url_raw( $action_url ), $action_attrs, esc_html( $action_text ) ); | |
| 86 | - } else { | |
| 87 | - printf( '<span class="order-action-text"%s>%s</span>', $action_attrs, esc_html( $action_text ) ); | |
| 85 | + if ( ! empty( $action_url ) ) { | |
| 86 | + printf( '<a href="%s"%s>%s</a>', esc_url_raw( $action_url ), $action_attrs, esc_html( $action_text ) ); | |
| 87 | + } else { | |
| 88 | + printf( '<span class="order-action-text"%s>%s</span>', $action_attrs, esc_html( $action_text ) ); | |
| 89 | + } | |
| 88 | 90 | } |
| 89 | 91 | } |
| 90 | - } | |
| 92 | + ?> | |
| 93 | + </td> | |
| 94 | + </tr> | |
| 95 | + <?php } ?> | |
| 96 | + </tbody> | |
| 97 | + | |
| 98 | + <tfoot> | |
| 99 | + <tr class="list-table-nav"> | |
| 100 | + <td colspan="3" class="nav-text" style="text-align: left; padding: 10px 20px"> | |
| 101 | + <?php echo esc_html( $query_orders->get_offset_text() ); ?> | |
| 102 | + </td> | |
| 103 | + <td colspan="2" class="nav-pages"> | |
| 104 | + <?php | |
| 105 | + //$query_orders->get_nav_numbers( true ); | |
| 106 | + $base_url = LP_Helper::getUrlCurrent(); | |
| 107 | + echo Template::instance()->html_pagination( | |
| 108 | + [ | |
| 109 | + 'total_pages' => $query_orders->get_pages(), | |
| 110 | + 'paged' => $query_orders->get_paged(), | |
| 111 | + 'format' => '%#%/', | |
| 112 | + 'base' => trailingslashit( preg_replace( '~\/[0-9]+\/?$~', '', $base_url ) ) . '%_%' | |
| 113 | + ] | |
| 114 | + ); | |
| 91 | 115 | ?> |
| 92 | 116 | </td> |
| 93 | 117 | </tr> |
| 94 | - <?php } ?> | |
| 95 | - </tbody> | |
| 96 | - | |
| 97 | - <tfoot> | |
| 98 | - <tr class="list-table-nav"> | |
| 99 | - <td colspan="3" class="nav-text"><?php echo esc_html( $query_orders->get_offset_text() ); ?></td> | |
| 100 | - <td colspan="2" class="nav-pages"><?php $query_orders->get_nav_numbers( true ); ?></td> | |
| 101 | - </tr> | |
| 102 | - </tfoot> | |
| 103 | -</table> | |
| 118 | + </tfoot> | |
| 119 | + </table> | |
| 120 | +</div> | |