| @@ -12,94 +12,79 @@ | ||
| 12 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | +$subscrpt_th_style = 'width:40%;padding:10px 14px;text-align:left;vertical-align:top;font-weight:600;color:#50575e;background-color:#f6f7f7;'; | |
| 17 | +$subscrpt_td_style = 'padding:10px 14px;text-align:left;vertical-align:top;color:#1d2327;'; | |
| 18 | +$subscrpt_divider = 'border-top:1px solid #e3e3e8;'; | |
| 16 | 19 | ?> |
| 17 | 20 | |
| 18 | -<div style="margin-bottom: 40px;"> | |
| 19 | - <table class="td" cellspacing="0" cellpadding="6" | |
| 20 | - style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" | |
| 21 | - border="1"> | |
| 22 | - <tbody> | |
| 23 | - <tr> | |
| 24 | - <h2> | |
| 25 | - <?php | |
| 26 | - esc_html_e( 'Related Subscriptions', 'subscription' ); | |
| 27 | - ?> | |
| 28 | - </h2> | |
| 29 | - <?php | |
| 30 | - if ( ! $order->has_status( 'completed' ) ) : | |
| 31 | - ?> | |
| 32 | - <p><small><?php esc_html_e( 'Your subscription will be activated when order status is completed.', 'subscription' ); ?></small></p> | |
| 33 | - <?php endif; ?> | |
| 34 | - </tr> | |
| 35 | - <?php | |
| 36 | - foreach ( $histories as $history ) : | |
| 37 | - $item = $order->get_item( $history->order_item_id ); | |
| 21 | +<div style="margin-bottom:40px;"> | |
| 22 | + <h2 style="margin:0 0 8px;"><?php esc_html_e( 'Related Subscriptions', 'subscription' ); ?></h2> | |
| 38 | 23 | |
| 39 | - // Skip if item is not found. | |
| 40 | - if ( ! $item ) { | |
| 41 | - continue; | |
| 42 | - } | |
| 24 | + <?php if ( ! $order->has_status( 'completed' ) ) : ?> | |
| 25 | + <p style="margin:0 0 16px;"><small><?php esc_html_e( 'Your subscription will be activated when order status is completed.', 'subscription' ); ?></small></p> | |
| 26 | + <?php endif; ?> | |
| 43 | 27 | |
| 44 | - $item_meta = wc_get_order_item_meta( $history->order_item_id, '_subscrpt_meta', true ); | |
| 45 | - $subscription_id = $history->subscription_id; | |
| 46 | - $subscription_status_object = get_post_status_object( get_post_status( $subscription_id ) ); | |
| 47 | - $cost = get_post_meta( $subscription_id, '_subscrpt_price', true ); | |
| 48 | - $has_trial = isset( $item_meta['trial'] ) && strlen( $item_meta['trial'] ) > 2; | |
| 49 | - $start_date = get_post_meta( $subscription_id, '_subscrpt_start_date', true ); | |
| 50 | - $next_date = get_post_meta( $subscription_id, '_subscrpt_next_date', true ); | |
| 51 | - ?> | |
| 52 | - <tr> | |
| 53 | - <th class="td" scope="row" colspan="3" | |
| 54 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: center;"><?php echo wp_kses_post( get_the_title( $subscription_id ) ); ?></th> | |
| 55 | - </tr> | |
| 56 | - <tr> | |
| 57 | - <th class="td" scope="row" colspan="2" | |
| 58 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Item', 'subscription' ); ?> </th> | |
| 59 | - <th class="td" scope="row" colspan="3" | |
| 60 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"> | |
| 61 | - <a href="<?php echo esc_url( get_permalink( $item->get_product_id() ?? '' ) ); ?>"><?php echo wp_kses_post( $item->get_name() ); ?></a> | |
| 62 | - <strong class="product-quantity">× <?php echo esc_html( $item->get_quantity() ); ?></strong> | |
| 63 | - </th> | |
| 64 | - </tr> | |
| 65 | - <tr> | |
| 66 | - <th class="td" scope="row" colspan="2" | |
| 67 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Status', 'subscription' ); ?> </th> | |
| 68 | - <td class="td" | |
| 69 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo esc_html( $subscription_status_object->label ); ?></td> | |
| 70 | - </tr> | |
| 71 | - <tr> | |
| 72 | - <th class="td" scope="row" colspan="2" | |
| 73 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"> | |
| 74 | - <?php esc_html_e( 'Recurring amount', 'subscription' ); ?> </th> | |
| 75 | - <td class="td" | |
| 76 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo wp_kses_post( SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( $cost, $item->get_id() ) ); ?></td> | |
| 77 | - </tr> | |
| 28 | + <?php | |
| 29 | + foreach ( $histories as $history ) : | |
| 30 | + $item = $order->get_item( $history->order_item_id ); | |
| 78 | 31 | |
| 79 | - <?php if ( $has_trial ) : ?> | |
| 80 | - <tr> | |
| 81 | - <th class="td" scope="row" colspan="2" | |
| 82 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'Trial', 'subscription' ); ?> | |
| 83 | - </th> | |
| 84 | - <td class="td" | |
| 85 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo esc_html( $item_meta['trial'] ); ?></td> | |
| 86 | - </tr> | |
| 87 | - <tr> | |
| 88 | - <th class="td" scope="row" colspan="2" | |
| 89 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php esc_html_e( 'First billing on', 'subscription' ); ?> | |
| 90 | - </th> | |
| 91 | - <td class="td" | |
| 92 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left;"><?php echo ! empty( $start_date ) ? esc_html( wp_date( 'F d, Y', $start_date ) ) : '-'; ?></td> | |
| 93 | - </tr> | |
| 94 | - <?php endif; ?> | |
| 32 | + // Skip if item is not found. | |
| 33 | + if ( ! $item ) { | |
| 34 | + continue; | |
| 35 | + } | |
| 95 | 36 | |
| 96 | - <tr> | |
| 97 | - <th class="td" scope="row" colspan="3" | |
| 98 | - style="color: #636363; border: 1px solid #e5e5e5; vertical-align: middle; padding: 12px; text-align: left; padding-bottom: 30px;"></th> | |
| 99 | - </tr> | |
| 100 | - <?php | |
| 101 | - endforeach; | |
| 37 | + $item_meta = wc_get_order_item_meta( $history->order_item_id, '_subscrpt_meta', true ); | |
| 38 | + $subscription_id = $history->subscription_id; | |
| 39 | + $subscription_status_object = get_post_status_object( get_post_status( $subscription_id ) ); | |
| 40 | + $has_trial = isset( $item_meta['trial'] ) && strlen( $item_meta['trial'] ) > 2; | |
| 41 | + $start_date = get_post_meta( $subscription_id, '_subscrpt_start_date', true ); | |
| 102 | 42 | ?> |
| 103 | - </tbody> | |
| 104 | - </table> | |
| 43 | + <div style="margin-bottom:24px;"> | |
| 44 | + <p style="margin:0 0 6px;font-weight:600;color:#1d2327;"><?php echo wp_kses_post( get_the_title( $subscription_id ) ); ?></p> | |
| 45 | + | |
| 46 | + <table cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:separate;border-spacing:0;border:1px solid #e3e3e8;border-radius:6px;overflow:hidden;font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif;font-size:14px;"> | |
| 47 | + <tbody> | |
| 48 | + <tr> | |
| 49 | + <th scope="row" style="<?php echo esc_attr( $subscrpt_th_style ); ?>"><?php esc_html_e( 'Item', 'subscription' ); ?></th> | |
| 50 | + <td style="<?php echo esc_attr( $subscrpt_td_style ); ?>"> | |
| 51 | + <a href="<?php echo esc_url( get_permalink( $item->get_product_id() ) ); ?>" style="color:#7f54b3;"><?php echo wp_kses_post( $item->get_name() ); ?></a> | |
| 52 | + <strong class="product-quantity">× <?php echo esc_html( $item->get_quantity() ); ?></strong> | |
| 53 | + </td> | |
| 54 | + </tr> | |
| 55 | + <tr> | |
| 56 | + <th scope="row" style="<?php echo esc_attr( $subscrpt_th_style . $subscrpt_divider ); ?>"><?php esc_html_e( 'Status', 'subscription' ); ?></th> | |
| 57 | + <td style="<?php echo esc_attr( $subscrpt_td_style . $subscrpt_divider ); ?>"><?php echo esc_html( $subscription_status_object->label ); ?></td> | |
| 58 | + </tr> | |
| 59 | + <tr> | |
| 60 | + <th scope="row" style="<?php echo esc_attr( $subscrpt_th_style . $subscrpt_divider ); ?>"><?php esc_html_e( 'Recurring amount', 'subscription' ); ?></th> | |
| 61 | + <td style="<?php echo esc_attr( $subscrpt_td_style . $subscrpt_divider ); ?>"> | |
| 62 | + <?php | |
| 63 | + // Strikes the original amount when a discount carries into renewals. | |
| 64 | + echo wp_kses_post( | |
| 65 | + SpringDevs\Subscription\Illuminate\Helper::get_subscription_recurring_price_html( | |
| 66 | + $subscription_id, | |
| 67 | + $item, | |
| 68 | + [ 'del_style' => 'color: #999999;' ] | |
| 69 | + ) | |
| 70 | + ); | |
| 71 | + ?> | |
| 72 | + </td> | |
| 73 | + </tr> | |
| 74 | + <?php if ( $has_trial ) : ?> | |
| 75 | + <tr> | |
| 76 | + <th scope="row" style="<?php echo esc_attr( $subscrpt_th_style . $subscrpt_divider ); ?>"><?php esc_html_e( 'Trial', 'subscription' ); ?></th> | |
| 77 | + <td style="<?php echo esc_attr( $subscrpt_td_style . $subscrpt_divider ); ?>"><?php echo esc_html( $item_meta['trial'] ); ?></td> | |
| 78 | + </tr> | |
| 79 | + <tr> | |
| 80 | + <th scope="row" style="<?php echo esc_attr( $subscrpt_th_style . $subscrpt_divider ); ?>"><?php esc_html_e( 'First billing on', 'subscription' ); ?></th> | |
| 81 | + <td style="<?php echo esc_attr( $subscrpt_td_style . $subscrpt_divider ); ?>"><?php echo ! empty( $start_date ) ? esc_html( wp_date( 'F d, Y', $start_date ) ) : '-'; ?></td> | |
| 82 | + </tr> | |
| 83 | + <?php endif; ?> | |
| 84 | + </tbody> | |
| 85 | + </table> | |
| 86 | + </div> | |
| 87 | + <?php | |
| 88 | + endforeach; | |
| 89 | + ?> | |
| 105 | 90 | </div> |