| @@ -7,11 +7,8 @@ | ||
| 7 | 7 | * |
| 8 | 8 | * This template can be overridden by copying it to <your_theme>/subscription/myaccount/subscriptions.php |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -use SpringDevs\Subscription\Illuminate\Helper; | |
| 12 | -use SpringDevs\Subscription\Illuminate\Subscription\Subscription; | |
| 13 | - | |
| 14 | 11 | // Exit if accessed directly. |
| 15 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | 13 | exit; |
| 17 | 14 | } |
| @@ -24,9 +21,9 @@ | ||
| 24 | 21 | <th scope="col" class="order-status"><?php esc_html_e( 'Status', 'subscription' ); ?></th> |
| 25 | 22 | <th scope="col" class="order-product"><?php esc_html_e( 'Product', 'subscription' ); ?></th> |
| 26 | 23 | <th scope="col" class="subscrpt-next-date"><?php esc_html_e( 'Next Payment', 'subscription' ); ?></th> |
| 27 | 24 | <th scope="col" class="subscrpt-total"><?php esc_html_e( 'Total', 'subscription' ); ?></th> |
| 28 | - <th scope="col" class="subscrpt-action"><?php esc_html_e( 'Actions', 'subscription' ); ?></th> | |
| 25 | + <th scope="col" class="subscrpt-action">Actions</th> | |
| 29 | 26 | </tr> |
| 30 | 27 | </thead> |
| 31 | 28 | <tbody> |
| 32 | 29 | <?php |
| @@ -34,9 +31,9 @@ | ||
| 34 | 31 | while ( $postslist->have_posts() ) : |
| 35 | 32 | $postslist->the_post(); |
| 36 | 33 | |
| 37 | 34 | $subscription_id = get_the_ID(); |
| 38 | - $subscription_data = Helper::get_subscription_data( $subscription_id ); | |
| 35 | + $subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id ); | |
| 39 | 36 | |
| 40 | 37 | if ( ! $subscription_data ) { |
| 41 | 38 | continue; |
| 42 | 39 | } |
| @@ -41,9 +38,9 @@ | ||
| 41 | 38 | continue; |
| 42 | 39 | } |
| 43 | 40 | |
| 44 | 41 | $subscrpt_status = $subscription_data['status'] ?? ''; |
| 45 | - $verbose_status = Helper::get_verbose_status( $subscrpt_status ); | |
| 42 | + $verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status ); | |
| 46 | 43 | |
| 47 | 44 | $order_id = $subscription_data['order']['order_id'] ?? 0; |
| 48 | 45 | $order_item_id = $subscription_data['order']['order_item_id'] ?? 0; |
| 49 | 46 | |
| @@ -61,9 +58,9 @@ | ||
| 61 | 58 | $start_date = $subscription_data['start_date'] ?? ''; |
| 62 | 59 | $start_date = ! empty( $start_date ) ? wp_date( 'F j, Y', strtotime( $start_date ) ) : '-'; |
| 63 | 60 | |
| 64 | 61 | $next_date = $subscription_data['next_date'] ?? ''; |
| 65 | - $next_date = ! empty( $next_date ) && SpringDevs\Subscription\Illuminate\Helper::has_next_payment( $subscrpt_status ) ? wp_date( 'F j, Y', strtotime( $next_date ) ) : '-'; | |
| 62 | + $next_date = ! empty( $next_date ) ? wp_date( 'F j, Y', strtotime( $next_date ) ) : '-'; | |
| 66 | 63 | |
| 67 | 64 | $trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true ); |
| 68 | 65 | $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true ); |
| 69 | 66 | $trial_mode = empty( $trial_mode ) ? 'off' : $trial_mode; |
| @@ -68,12 +65,12 @@ | ||
| 68 | 65 | $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true ); |
| 69 | 66 | $trial_mode = empty( $trial_mode ) ? 'off' : $trial_mode; |
| 70 | 67 | |
| 71 | 68 | // Renewal total, already net of any discount that recurs. |
| 72 | - $display_totals = Helper::get_subscription_display_totals( $subscription_id, $order_item ); | |
| 69 | + $display_totals = SpringDevs\Subscription\Illuminate\Helper::get_subscription_display_totals( $subscription_id, $order_item ); | |
| 73 | 70 | $price = $display_totals['total']; |
| 74 | 71 | |
| 75 | - $product_price_html = Helper::format_price_with_order_item( $price, $order_item->get_id() ); | |
| 72 | + $product_price_html = SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( $price, $order_item->get_id() ); | |
| 76 | 73 | |
| 77 | 74 | $is_grace_period = isset( $subscription_data['grace_period'] ); |
| 78 | 75 | $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0; |
| 79 | 76 | |
| @@ -78,19 +75,19 @@ | ||
| 78 | 75 | $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0; |
| 79 | 76 | |
| 80 | 77 | $my_account_page_id = get_option( 'woocommerce_myaccount_page_id' ); |
| 81 | 78 | $my_account_url = get_permalink( $my_account_page_id ); |
| 82 | - $view_sub_endpoint = Subscription::get_user_endpoint( 'view_subs' ); | |
| 79 | + $view_sub_endpoint = SpringDevs\Subscription\Illuminate\Subscription\Subscription::get_user_endpoint( 'view_subs' ); | |
| 83 | 80 | $view_sub_url = wc_get_endpoint_url( $view_sub_endpoint, get_the_ID(), $my_account_url ); |
| 84 | 81 | ?> |
| 85 | 82 | |
| 86 | 83 | <tr> |
| 87 | - <td data-title="<?php echo esc_attr__( 'Subscription', 'subscription' ); ?>"><?php the_ID(); ?></td> | |
| 84 | + <td data-title="Subscription"><?php the_ID(); ?></td> | |
| 88 | 85 | |
| 89 | - <td data-title="<?php echo esc_attr__( 'Status', 'subscription' ); ?>"> | |
| 86 | + <td data-title="Status"> | |
| 90 | 87 | <?php if ( $is_grace_period && $grace_remaining > 0 ) : ?> |
| 91 | 88 | <span class="subscrpt-legacy-status subscrpt-legacy-status--active grace-active"> |
| 92 | - <?php esc_html_e( 'Active', 'subscription' ); ?> | |
| 89 | + Active | |
| 93 | 90 | |
| 94 | 91 | <?php |
| 95 | 92 | $grace_remaining_text = sprintf( |
| 96 | 93 | // translators: Number of days remaining in grace period. |
| @@ -103,24 +100,24 @@ | ||
| 103 | 100 | </span> |
| 104 | 101 | </span> |
| 105 | 102 | <?php else : ?> |
| 106 | 103 | <span class="subscrpt-legacy-status subscrpt-legacy-status--<?php echo esc_attr( strtolower( $subscrpt_status ) ); ?>"> |
| 107 | - <?php echo esc_html( mb_strlen( $verbose_status ) > 9 ? mb_substr( $verbose_status, 0, 9 ) . '...' : $verbose_status ); ?> | |
| 104 | + <?php echo esc_html( strlen( $verbose_status ) > 9 ? substr( $verbose_status, 0, 9 ) . '...' : $verbose_status ); ?> | |
| 108 | 105 | </span> |
| 109 | 106 | <?php endif; ?> |
| 110 | 107 | </td> |
| 111 | 108 | |
| 112 | - <td data-title="<?php echo esc_attr__( 'Product', 'subscription' ); ?>"><?php echo esc_html( $product_name ); ?></td> | |
| 109 | + <td data-title="Product"><?php echo esc_html( $product_name ); ?></td> | |
| 113 | 110 | |
| 114 | - <?php if ( 'on' !== $trial_mode || ! SpringDevs\Subscription\Illuminate\Helper::has_next_payment( $subscrpt_status ) ) : ?> | |
| 115 | - <td data-title="<?php echo esc_attr__( 'Next Payment', 'subscription' ); ?>"><?php echo esc_html( $next_date ); ?></td> | |
| 111 | + <?php if ( 'on' !== $trial_mode ) : ?> | |
| 112 | + <td data-title="Next Payment"><?php echo esc_html( $next_date ); ?></td> | |
| 116 | 113 | <?php else : ?> |
| 117 | - <td data-title="<?php echo esc_attr__( 'Next Payment', 'subscription' ); ?>"><small><?php esc_html_e( 'First Billing:', 'subscription' ); ?> </small><?php echo esc_html( $start_date ); ?></td> | |
| 114 | + <td data-title="Next Payment"><small>First Billing : </small><?php echo esc_html( $start_date ); ?></td> | |
| 118 | 115 | <?php endif; ?> |
| 119 | 116 | |
| 120 | - <td data-title="<?php echo esc_attr__( 'Total', 'subscription' ); ?>"><?php echo wp_kses_post( $product_price_html ); ?></td> | |
| 117 | + <td data-title="Total"><?php echo wp_kses_post( $product_price_html ); ?></td> | |
| 121 | 118 | |
| 122 | - <td data-title="<?php echo esc_attr__( 'Actions', 'subscription' ); ?>"> | |
| 119 | + <td data-title="Actions"> | |
| 123 | 120 | <a href="<?php echo esc_url( $view_sub_url ); ?>" class="woocommerce-button <?php echo esc_attr( $wp_button_class ); ?> button view"> |
| 124 | 121 | <?php echo esc_html_e( 'View', 'subscription' ); ?> |
| 125 | 122 | </a> |
| 126 | 123 | </td> |
| @@ -145,12 +142,12 @@ | ||
| 145 | 142 | |
| 146 | 143 | <?php if ( 1 < $postslist->max_num_pages ) : ?> |
| 147 | 144 | <div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination"> |
| 148 | 145 | <?php if ( 1 !== $current_page ) : ?> |
| 149 | - <a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous button<?php echo esc_attr( $wp_button_class ); ?>" href="<?php echo esc_url( wc_get_endpoint_url( Subscription::get_user_endpoint( 'subs_list' ), $current_page - 1 ) ); ?>"><?php esc_html_e( 'Previous', 'subscription' ); ?></a> | |
| 146 | + <a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous button<?php echo esc_attr( $wp_button_class ); ?>" href="<?php echo esc_url( wc_get_endpoint_url( 'subscriptions', $current_page - 1 ) ); ?>"><?php esc_html_e( 'Previous', 'subscription' ); ?></a> | |
| 150 | 147 | <?php endif; ?> |
| 151 | 148 | |
| 152 | 149 | <?php if ( intval( $postslist->max_num_pages ) !== $current_page ) : ?> |
| 153 | - <a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next button<?php echo esc_attr( $wp_button_class ); ?>" href="<?php echo esc_url( wc_get_endpoint_url( Subscription::get_user_endpoint( 'subs_list' ), $current_page + 1 ) ); ?>"><?php esc_html_e( 'Next', 'subscription' ); ?></a> | |
| 150 | + <a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next button<?php echo esc_attr( $wp_button_class ); ?>" href="<?php echo esc_url( wc_get_endpoint_url( 'subscriptions', $current_page + 1 ) ); ?>"><?php esc_html_e( 'Next', 'subscription' ); ?></a> | |
| 154 | 151 | <?php endif; ?> |
| 155 | 152 | </div> |
| 156 | 153 | <?php endif; ?> |