PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.9.5
Subscriptions for WooCommerce with Stripe Recurring Payments v1.9.5
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / templates / myaccount / subscriptions.php

subscriptions.php in Subscriptions for WooCommerce with Stripe Recurring Payments 1.9.5, at templates/myaccount/subscriptions.php

150 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Subscriptions Table
4 *
5 * @var int $current_page
6 * @var WP_Query $postslist
7 *
8 * This template can be overridden by copying it to <your_theme>/subscription/myaccount/subscriptions.php
9 */
10
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15 ?>
16
17 <table class="woocommerce-orders-table woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table my_account_subscrpt">
18 <thead>
19 <tr>
20 <th scope="col" class="subscrpt-id"><?php esc_html_e( 'Subscription', 'subscription' ); ?></th>
21 <th scope="col" class="order-status"><?php esc_html_e( 'Status', 'subscription' ); ?></th>
22 <th scope="col" class="order-product"><?php esc_html_e( 'Product', 'subscription' ); ?></th>
23 <th scope="col" class="subscrpt-next-date"><?php esc_html_e( 'Next Payment', 'subscription' ); ?></th>
24 <th scope="col" class="subscrpt-total"><?php esc_html_e( 'Total', 'subscription' ); ?></th>
25 <th scope="col" class="subscrpt-action">Actions</th>
26 </tr>
27 </thead>
28 <tbody>
29 <?php
30 if ( $postslist->have_posts() ) :
31 while ( $postslist->have_posts() ) :
32 $postslist->the_post();
33
34 $subscription_id = get_the_ID();
35 $subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id );
36
37 $subscrpt_status = $subscription_data['status'] ?? '';
38 $verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status );
39
40 $order_id = $subscription_data['order']['order_id'] ?? 0;
41 $order_item_id = $subscription_data['order']['order_item_id'] ?? 0;
42
43 $order = wc_get_order( $order_id );
44 $order_item = $order->get_item( $order_item_id );
45
46 $product_id = $subscription_data['product']['product_id'] ?? 0;
47 $product_name = $order_item->get_name();
48
49 $start_date = $subscription_data['start_date'] ?? '';
50 $start_date = ! empty( $start_date ) ? wp_date( 'F j, Y', strtotime( $start_date ) ) : '-';
51
52 $next_date = $subscription_data['next_date'] ?? '';
53 $next_date = ! empty( $next_date ) ? wp_date( 'F j, Y', strtotime( $next_date ) ) : '-';
54
55 $trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true );
56 $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true );
57 $trial_mode = empty( $trial_mode ) ? 'off' : $trial_mode;
58
59 $price = $subscription_data['price'] ?? 0;
60 $price_excl_tax = (float) $order_item->get_total();
61 $tax_amount = (float) $order_item->get_total_tax();
62
63 if ( $tax_amount > 0 ) {
64 $price = $price_excl_tax + $tax_amount;
65 $price = number_format( (float) $price, 2, '.', '' );
66 }
67
68 $product_price_html = SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( $price, $order_item->get_id() );
69
70 $is_grace_period = isset( $subscription_data['grace_period'] );
71 $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
72
73 $my_account_page_id = get_option( 'woocommerce_myaccount_page_id' );
74 $my_account_url = get_permalink( $my_account_page_id );
75 $view_sub_endpoint = SpringDevs\Subscription\Illuminate\Subscription\Subscription::get_user_endpoint( 'view_subs' );
76 $view_sub_url = wc_get_endpoint_url( $view_sub_endpoint, get_the_ID(), $my_account_url );
77 ?>
78
79 <tr>
80 <td data-title="Subscription"><?php the_ID(); ?></td>
81
82 <td data-title="Status">
83 <?php if ( $is_grace_period && $grace_remaining > 0 ) : ?>
84 <span class="subscrpt-active grace-active">
85 Active
86
87 <?php
88 $grace_remaining_text = sprintf(
89 // translators: Number of days remaining in grace period.
90 __( '%d days remaining!', 'subscription' ),
91 $grace_remaining
92 );
93 ?>
94 <span class="grace-icon" data-tooltip="<?php echo esc_attr( $grace_remaining_text ); ?>">
95 <span class="dashicons dashicons-warning"></span>
96 </span>
97 </span>
98 <?php else : ?>
99 <span class="subscrpt-<?php echo esc_attr( strtolower( $subscrpt_status ) ); ?>">
100 <?php echo esc_html( strlen( $verbose_status ) > 9 ? substr( $verbose_status, 0, 9 ) . '...' : $verbose_status ); ?>
101 </span>
102 <?php endif; ?>
103 </td>
104
105 <td data-title="Product"><?php echo esc_html( $product_name ); ?></td>
106
107 <?php if ( 'on' !== $trial_mode ) : ?>
108 <td data-title="Next Payment"><?php echo esc_html( $next_date ); ?></td>
109 <?php else : ?>
110 <td data-title="Next Payment"><small>First Billing : </small><?php echo esc_html( $start_date ); ?></td>
111 <?php endif; ?>
112
113 <td data-title="Total"><?php echo wp_kses_post( $product_price_html ); ?></td>
114
115 <td data-title="Actions">
116 <a href="<?php echo esc_url( $view_sub_url ); ?>" class="woocommerce-button <?php echo esc_attr( $wp_button_class ); ?> button view">
117 <?php echo esc_html_e( 'View', 'subscription' ); ?>
118 </a>
119 </td>
120 </tr>
121 <?php
122 endwhile;
123 wp_reset_postdata();
124 else :
125 ?>
126 <tr>
127 <td colspan="6">
128 <p style="text-align: center;">
129 <?php echo esc_html_e( 'No subscriptions available yet.', 'subscription' ); ?>
130 </p>
131 </td>
132 </tr>
133 <?php
134 endif;
135 ?>
136 </tbody>
137 </table>
138
139 <?php if ( 1 < $postslist->max_num_pages ) : ?>
140 <div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination">
141 <?php if ( 1 !== $current_page ) : ?>
142 <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>
143 <?php endif; ?>
144
145 <?php if ( intval( $postslist->max_num_pages ) !== $current_page ) : ?>
146 <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>
147 <?php endif; ?>
148 </div>
149 <?php endif; ?>
150