feat: Card-based email system implementation
## ✅ Core Card System Complete! ### base.html Template - ✅ Single, theme-agnostic template - ✅ Card system CSS (default, highlight, info, warning, success, bg) - ✅ Customizable header (logo/text) - ✅ Customizable footer + social icons - ✅ Customizable body background - ✅ Mobile responsive - ✅ Email client compatible (Outlook, Gmail, etc.) ### EmailRenderer.php - Card Parser - ✅ `parse_cards()` - Parses [card]...[/card] syntax - ✅ `parse_card_attributes()` - Extracts type and bg attributes - ✅ `render_card()` - Renders card HTML - ✅ `render_card_spacing()` - 24px spacing between cards - ✅ `render_html()` - Email customization support - ✅ `get_social_icon_url()` - Social media icons ### Card Types Supported ``` [card] → Default white card [card type="highlight"] → Purple gradient card [card type="info"] → Blue info card [card type="warning"] → Yellow warning card [card type="success"] → Green success card [card bg="https://..."] → Background image card ``` ### Email Customization - ✅ Header: Logo or text - ✅ Body background color - ✅ Footer text - ✅ Social media links (Facebook, Instagram, Twitter, LinkedIn) - ✅ Stored in `woonoow_notification_settings[email_appearance]` ### Default Templates Updated - ✅ order_placed_email - Multi-card layout - ✅ order_processing_email - Success card + summary - ✅ Other templates ready to update --- **Architecture:** ``` Content with [card] tags ↓ parse_cards() ↓ render_card() × N ↓ base.html template ↓ Beautiful HTML email! 🎨 ``` **Next:** Settings UI + Live Preview 🚀
This commit is contained in:
@@ -143,7 +143,26 @@ class TemplateProvider {
|
||||
'event_id' => 'order_placed',
|
||||
'channel_id' => 'email',
|
||||
'subject' => $wc_new_order['subject'] ?? __('New Order #{order_number}', 'woonoow'),
|
||||
'body' => __("Hi Admin,\n\nYou have received a new order.\n\nOrder Number: {order_number}\nOrder Total: {order_total}\nCustomer: {customer_name}\nEmail: {customer_email}\n\nView order: {order_url}", 'woonoow'),
|
||||
'body' => __('[card]
|
||||
<h1>New Order Received</h1>
|
||||
<p>Hi Admin,</p>
|
||||
<p>You have received a new order from <strong>{customer_name}</strong>.</p>
|
||||
<div class="info-box">
|
||||
<p style="margin: 0;"><strong>Order #{order_number}</strong></p>
|
||||
<p style="margin: 0;">Total: {order_total}</p>
|
||||
</div>
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
<h2>Customer Details</h2>
|
||||
<p><strong>Name:</strong> {customer_name}<br>
|
||||
<strong>Email:</strong> {customer_email}<br>
|
||||
<strong>Phone:</strong> {customer_phone}</p>
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
<p style="text-align: center;"><a href="{order_url}" class="button">View Order Details</a></p>
|
||||
[/card]', 'woonoow'),
|
||||
'variables' => self::get_order_variables(),
|
||||
'wc_email_id' => 'WC_Email_New_Order',
|
||||
],
|
||||
@@ -151,7 +170,26 @@ class TemplateProvider {
|
||||
'event_id' => 'order_processing',
|
||||
'channel_id' => 'email',
|
||||
'subject' => $wc_processing['subject'] ?? __('Your order #{order_number} is being processed', 'woonoow'),
|
||||
'body' => __("Hi {customer_name},\n\nThank you for your order! We're now processing it.\n\nOrder Number: {order_number}\nOrder Total: {order_total}\nPayment Method: {payment_method}\n\nYou can track your order here: {order_url}\n\nBest regards,\n{store_name}", 'woonoow'),
|
||||
'body' => __('[card type="success"]
|
||||
<h1>✅ Order Confirmed!</h1>
|
||||
<p>Hi {customer_name},</p>
|
||||
<p>Thank you for your order! We\'re now processing it and will notify you once it ships.</p>
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
<h2>Order Summary</h2>
|
||||
<div class="info-box">
|
||||
<p style="margin: 0;"><strong>Order #{order_number}</strong></p>
|
||||
<p style="margin: 0;">Total: {order_total}</p>
|
||||
<p style="margin: 0;">Payment: {payment_method}</p>
|
||||
</div>
|
||||
{order_items}
|
||||
[/card]
|
||||
|
||||
[card]
|
||||
<p style="text-align: center;"><a href="{order_url}" class="button">Track Your Order</a></p>
|
||||
<p style="text-align: center; font-size: 14px; color: #888;">Questions? Reply to this email or contact us.</p>
|
||||
[/card]', 'woonoow'),
|
||||
'variables' => self::get_order_variables(),
|
||||
'wc_email_id' => 'WC_Email_Customer_Processing_Order',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user