← All changes
|
modules/email-report/templates/email-content-section.php
+174
-99
3.1.0
→
3.3.0
View file →
| @@ -1,113 +1,188 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Template Name: Email content. | |
| 3 | + * Template Name: Email content section. | |
| 4 | 4 | * |
| 5 | + * Expected variables (passed from Cartflows_Admin_Report_Emails::get_email_content()): | |
| 6 | + * - $user_name (string) Recipient display name. | |
| 7 | + * - $from_date (string) 7-day window start label (e.g. "May 27"). | |
| 8 | + * - $to_date (string) 7-day window end label (e.g. "Jun 3"). | |
| 9 | + * - $total_revenue (string) Weekly revenue HTML from wc_price(). | |
| 10 | + * - $total_orders (int|string) Weekly order count. | |
| 11 | + * - $total_visits (int|string) Weekly visits count (Pro only; "0" on Free). | |
| 12 | + * - $order_bump_revenue (string) Bump revenue HTML from wc_price() (Pro only). | |
| 13 | + * - $offers_revenue (string) Offers revenue HTML from wc_price() (Pro only). | |
| 14 | + * - $last_month_revenue (string) 30-day revenue HTML from wc_price(). | |
| 15 | + * | |
| 5 | 16 | * @package CartFlows |
| 6 | 17 | */ |
| 7 | 18 | |
| 8 | -// Exit if accessed directly. | |
| 9 | 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 20 | exit; |
| 11 | 21 | } |
| 22 | + | |
| 23 | +// Defensive defaults so the template renders without notices if a variable is missing. | |
| 24 | +$user_name = isset( $user_name ) ? $user_name : ''; | |
| 25 | +$from_date = isset( $from_date ) ? $from_date : ''; | |
| 26 | +$to_date = isset( $to_date ) ? $to_date : ''; | |
| 27 | +$total_revenue = isset( $total_revenue ) ? $total_revenue : ''; | |
| 28 | +$total_orders = isset( $total_orders ) ? $total_orders : 0; | |
| 29 | +$total_visits = isset( $total_visits ) ? $total_visits : 0; | |
| 30 | +$order_bump_revenue = isset( $order_bump_revenue ) ? $order_bump_revenue : ''; | |
| 31 | +$offers_revenue = isset( $offers_revenue ) ? $offers_revenue : ''; | |
| 32 | +$last_month_revenue = isset( $last_month_revenue ) ? $last_month_revenue : ''; | |
| 12 | 33 | ?> |
| 13 | -<table align="center" border="0" cellpadding="0" cellspacing="0" class="row row-3" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #fff3f0;" width="100%"> | |
| 14 | - <tbody> | |
| 15 | - <tr> | |
| 16 | - <td> | |
| 17 | - <table align="center" border="0" cellpadding="0" cellspacing="0" class="row-content stack" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #000000; width: 600px;" width="600"> | |
| 18 | - <tbody> | |
| 34 | +<tr> | |
| 35 | + <td class="px-lg modern-sans" style="padding:24px 40px 0 40px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif;"> | |
| 36 | + <p style="margin:0; font-size:22px; font-weight:700; color:#0f172a; line-height:1.3; letter-spacing:-0.01em;"> | |
| 37 | + <?php | |
| 38 | + /* translators: %s: user display name. */ | |
| 39 | + echo sprintf( esc_html__( 'Hi %s', 'cartflows' ), esc_html( $user_name ) ); | |
| 40 | + ?> | |
| 41 | + </p> | |
| 42 | + <p style="margin:8px 0 0 0; font-size:14px; color:#64748b; line-height:1.6;"> | |
| 43 | + <?php echo esc_html__( 'Quick report on how your store performed this week.', 'cartflows' ); ?> | |
| 44 | + </p> | |
| 45 | + </td> | |
| 46 | +</tr> | |
| 47 | + | |
| 48 | +<!-- Section: Last 7 Days --> | |
| 49 | +<tr> | |
| 50 | + <td class="px-lg" style="padding:36px 40px 0 40px;"> | |
| 51 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> | |
| 52 | + <tr> | |
| 53 | + <td valign="bottom" class="modern-sans" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; font-weight:700; color:#0f172a; letter-spacing:-0.01em;"> | |
| 54 | + <?php echo esc_html__( 'Last 7 days', 'cartflows' ); ?> | |
| 55 | + </td> | |
| 56 | + <td valign="bottom" align="right" class="modern-sans" style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; color:#94a3b8;"> | |
| 57 | + <?php echo esc_html( $from_date . ' – ' . $to_date ); ?> | |
| 58 | + </td> | |
| 59 | + </tr> | |
| 60 | + </table> | |
| 61 | + </td> | |
| 62 | +</tr> | |
| 63 | + | |
| 64 | +<!-- 2-column hero KPI cards: Total revenue + Orders placed --> | |
| 65 | +<tr> | |
| 66 | + <td class="px-lg" style="padding:16px 40px 0 40px;"> | |
| 67 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> | |
| 68 | + <tr> | |
| 69 | + <td class="stack" valign="top" width="50%" style="padding-right:8px;"> | |
| 70 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fff8f3; border:1px solid #fde8d8; border-radius:12px;"> | |
| 19 | 71 | <tr> |
| 20 | - <td class="column column-1" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-weight: 400; text-align: left; vertical-align: top; border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px;" width="50%"> | |
| 21 | - <table border="0" cellpadding="0" cellspacing="0" class="heading_block" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt;" width="100%"> | |
| 22 | - <tr> | |
| 23 | - <td style="padding-bottom:10px;padding-left:10px;padding-top:60px;text-align:center;width:100%;"> | |
| 24 | - <h1 style="margin: 0; color: #1f2937; direction: ltr; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; font-size: 32px; font-weight: 400; letter-spacing: normal; line-height: 120%; text-align: left; margin-top: 0; margin-bottom: 0;"> | |
| 25 | - <?php | |
| 26 | - /* translators: %s user name */ | |
| 27 | - echo sprintf( esc_html__( 'Hey %s!', 'cartflows' ), esc_attr( $user_name ) ); | |
| 28 | - ?> | |
| 29 | - </h1> | |
| 30 | - </td> | |
| 31 | - </tr> | |
| 32 | - </table> | |
| 33 | - <table border="0" cellpadding="0" cellspacing="0" class="text_block" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; word-break: break-word;" width="100%"> | |
| 34 | - <tr> | |
| 35 | - <td style="padding-bottom:55px;padding-left:10px;padding-right:10px;padding-top:10px;"> | |
| 36 | - <div style="font-family: sans-serif"> | |
| 37 | - <div style="font-size: 14px; mso-line-height-alt: 25.2px; color: #393d47; line-height: 1.8; font-family: Arial, Helvetica Neue, Helvetica, sans-serif;"> | |
| 38 | - <p style="margin: 0; font-size: 14px; text-align: left;"> | |
| 39 | - <?php | |
| 40 | - echo sprintf( | |
| 41 | - /* translators: %1$s: store name, %2$s: total revenue. %3$s: total revenue*/ | |
| 42 | - esc_html__( | |
| 43 | - '%1$s has earned a total %2$s in revenue last week by using CartFlows to power your store! And in the last month, it earned %3$s', | |
| 44 | - 'cartflows' | |
| 45 | - ), | |
| 46 | - esc_attr( $store_name ), | |
| 47 | - wp_kses_post( $total_revenue ), | |
| 48 | - wp_kses_post( $last_month_revenue ) | |
| 49 | - ); | |
| 50 | - ?> | |
| 51 | - </p> | |
| 52 | - </div> | |
| 53 | - </div> | |
| 54 | - </td> | |
| 55 | - </tr> | |
| 56 | - </table> | |
| 72 | + <td align="center" style="padding:28px 20px;"> | |
| 73 | + <p class="hero-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:36px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.025em;"> | |
| 74 | + <?php echo wp_kses_post( $total_revenue ); ?> | |
| 75 | + </p> | |
| 76 | + <p class="modern-sans" style="margin:10px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; color:#64748b; line-height:1.4;"> | |
| 77 | + <?php echo esc_html__( 'Total revenue', 'cartflows' ); ?> | |
| 78 | + </p> | |
| 57 | 79 | </td> |
| 58 | - <td class="column column-2" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-weight: 400; text-align: left; vertical-align: top; border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px;" width="50%"> | |
| 59 | - <table border="0" cellpadding="0" cellspacing="0" class="heading_block" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt;" width="100%"> | |
| 60 | - <tr> | |
| 61 | - <td style="padding-bottom:10px;padding-top:60px;text-align:center;width:100%;"> | |
| 62 | - <h1 style="margin: 0; color: #1f2937; direction: ltr; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; font-size: 32px; font-weight: 400; letter-spacing: normal; line-height: 120%; text-align: center; margin-top: 0; margin-bottom: 0;"> | |
| 63 | - <?php echo wp_kses_post( $total_revenue ); ?> | |
| 64 | - </h1> | |
| 65 | - </td> | |
| 66 | - </tr> | |
| 67 | - </table> | |
| 68 | - <table border="0" cellpadding="0" cellspacing="0" class="text_block" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; word-break: break-word;" width="100%"> | |
| 69 | - <tr> | |
| 70 | - <td style="padding-bottom:55px;padding-left:10px;padding-right:10px;padding-top:10px;"> | |
| 71 | - <div style="font-family: sans-serif"> | |
| 72 | - <div style="font-size: 14px; mso-line-height-alt: 16.8px; color: #393d47; line-height: 1.2; font-family: Arial, Helvetica Neue, Helvetica, sans-serif;"> | |
| 73 | - <p style="margin: 0; font-size: 14px; text-align: center;"> | |
| 74 | - <span style="font-size:14px;"><?php echo esc_html( $from_date . ' - ' . $to_date ); ?></span> | |
| 75 | - </p> | |
| 76 | - <p style="margin: 0; font-size: 14px; text-align: center;"> | |
| 77 | - <span style="font-size:12px;"> | |
| 78 | - <?php | |
| 79 | - echo esc_html__( | |
| 80 | - '(Last 7 days)', | |
| 81 | - 'cartflows' | |
| 82 | - ); | |
| 83 | - ?> | |
| 84 | - </span> | |
| 85 | - </p> | |
| 86 | - <p style="margin: 0; font-size: 14px; text-align: center; mso-line-height-alt: 16.8px;"> </p> | |
| 87 | - <p style="margin: 0; font-size: 22px; text-align: center;"> | |
| 88 | - <?php echo wp_kses_post( $last_month_revenue ); ?> | |
| 89 | - </p> | |
| 90 | - <p style="margin: 0; text-align: center;"> | |
| 91 | - <span style="font-size:12px;"> | |
| 92 | - <?php | |
| 93 | - echo esc_html__( | |
| 94 | - '(Last 30 days)', | |
| 95 | - 'cartflows' | |
| 96 | - ); | |
| 97 | - ?> | |
| 98 | - </span> | |
| 99 | - </p> | |
| 100 | - </div> | |
| 101 | - </div> | |
| 102 | - </td> | |
| 103 | - </tr> | |
| 104 | - </table> | |
| 80 | + </tr> | |
| 81 | + </table> | |
| 82 | + </td> | |
| 83 | + <td class="stack stack-last" valign="top" width="50%" style="padding-left:8px;"> | |
| 84 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fff8f3; border:1px solid #fde8d8; border-radius:12px;"> | |
| 85 | + <tr> | |
| 86 | + <td align="center" style="padding:28px 20px;"> | |
| 87 | + <p class="hero-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:36px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.025em;"> | |
| 88 | + <?php echo esc_html( number_format_i18n( (int) $total_orders ) ); ?> | |
| 89 | + </p> | |
| 90 | + <p class="modern-sans" style="margin:10px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; color:#64748b; line-height:1.4;"> | |
| 91 | + <?php echo esc_html__( 'Orders placed', 'cartflows' ); ?> | |
| 92 | + </p> | |
| 105 | 93 | </td> |
| 106 | 94 | </tr> |
| 107 | - </tbody> | |
| 108 | - </table> | |
| 109 | - </td> | |
| 110 | - </tr> | |
| 111 | - </tbody> | |
| 112 | -</table> | |
| 113 | -<?php | |
| 95 | + </table> | |
| 96 | + </td> | |
| 97 | + </tr> | |
| 98 | + </table> | |
| 99 | + </td> | |
| 100 | +</tr> | |
| 101 | + | |
| 102 | +<!-- 3-column KPI cards: Total visits + Order bumps + Offers revenue --> | |
| 103 | +<tr> | |
| 104 | + <td class="px-lg" style="padding:16px 40px 0 40px;"> | |
| 105 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> | |
| 106 | + <tr> | |
| 107 | + <td class="stack" valign="top" width="33.33%" style="padding-right:6px;"> | |
| 108 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fafafa; border:1px solid #ececec; border-radius:12px;"> | |
| 109 | + <tr> | |
| 110 | + <td align="center" style="padding:22px 16px;"> | |
| 111 | + <p class="kpi-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:28px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.02em;"> | |
| 112 | + <?php echo esc_html( number_format_i18n( (int) $total_visits ) ); ?> | |
| 113 | + </p> | |
| 114 | + <p class="modern-sans" style="margin:8px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:12px; color:#64748b; line-height:1.4;"> | |
| 115 | + <?php echo esc_html__( 'Total visits', 'cartflows' ); ?> | |
| 116 | + </p> | |
| 117 | + </td> | |
| 118 | + </tr> | |
| 119 | + </table> | |
| 120 | + </td> | |
| 121 | + <td class="stack" valign="top" width="33.33%" style="padding:0 6px;"> | |
| 122 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fafafa; border:1px solid #ececec; border-radius:12px;"> | |
| 123 | + <tr> | |
| 124 | + <td align="center" style="padding:22px 16px;"> | |
| 125 | + <p class="kpi-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:28px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.02em;"> | |
| 126 | + <?php echo wp_kses_post( $order_bump_revenue ); ?> | |
| 127 | + </p> | |
| 128 | + <p class="modern-sans" style="margin:8px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:12px; color:#64748b; line-height:1.4;"> | |
| 129 | + <?php echo esc_html__( 'Order bumps', 'cartflows' ); ?> | |
| 130 | + </p> | |
| 131 | + </td> | |
| 132 | + </tr> | |
| 133 | + </table> | |
| 134 | + </td> | |
| 135 | + <td class="stack stack-last" valign="top" width="33.33%" style="padding-left:6px;"> | |
| 136 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fafafa; border:1px solid #ececec; border-radius:12px;"> | |
| 137 | + <tr> | |
| 138 | + <td align="center" style="padding:22px 16px;"> | |
| 139 | + <p class="kpi-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:28px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.02em;"> | |
| 140 | + <?php echo wp_kses_post( $offers_revenue ); ?> | |
| 141 | + </p> | |
| 142 | + <p class="modern-sans" style="margin:8px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:12px; color:#64748b; line-height:1.4;"> | |
| 143 | + <?php echo esc_html__( 'Offers revenue', 'cartflows' ); ?> | |
| 144 | + </p> | |
| 145 | + </td> | |
| 146 | + </tr> | |
| 147 | + </table> | |
| 148 | + </td> | |
| 149 | + </tr> | |
| 150 | + </table> | |
| 151 | + </td> | |
| 152 | +</tr> | |
| 153 | + | |
| 154 | +<!-- Section: Last 30 Days --> | |
| 155 | +<tr> | |
| 156 | + <td class="px-lg" style="padding:32px 40px 0 40px;"> | |
| 157 | + <p class="modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; font-weight:700; color:#0f172a; letter-spacing:-0.01em;"> | |
| 158 | + <?php echo esc_html__( 'Last 30 days', 'cartflows' ); ?> | |
| 159 | + </p> | |
| 160 | + </td> | |
| 161 | +</tr> | |
| 162 | + | |
| 163 | +<!-- Full-width 30-day card --> | |
| 164 | +<tr> | |
| 165 | + <td class="px-lg" style="padding:16px 40px 0 40px;"> | |
| 166 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fff8f3; border:1px solid #fde8d8; border-radius:12px;"> | |
| 167 | + <tr> | |
| 168 | + <td align="center" style="padding:32px 24px;"> | |
| 169 | + <p class="hero-num modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:40px; font-weight:700; color:#0f172a; line-height:1; letter-spacing:-0.025em;"> | |
| 170 | + <?php echo wp_kses_post( $last_month_revenue ); ?> | |
| 171 | + </p> | |
| 172 | + <p class="modern-sans" style="margin:10px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; color:#64748b; line-height:1.4;"> | |
| 173 | + <?php echo esc_html__( 'Total revenue', 'cartflows' ); ?> | |
| 174 | + </p> | |
| 175 | + </td> | |
| 176 | + </tr> | |
| 177 | + </table> | |
| 178 | + </td> | |
| 179 | +</tr> | |
| 180 | + | |
| 181 | +<!-- Divider --> | |
| 182 | +<tr> | |
| 183 | + <td class="px-lg" style="padding:36px 40px 0 40px;"> | |
| 184 | + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> | |
| 185 | + <tr><td height="1" bgcolor="#eeeae3" style="line-height:1px; font-size:1px;"> </td></tr> | |
| 186 | + </table> | |
| 187 | + </td> | |
| 188 | +</tr> | |