dwindown
|
7394d2f213
|
feat: Add comprehensive email flow diagnostics and logging
🔍 Email Flow Diagnostic Tool:
Created test-email-flow.php - comprehensive diagnostic dashboard:
- System status (notification mode, email channel, Action Scheduler)
- Event configuration checker
- Email queue status (wp_options)
- Action Scheduler queue status
- Recent email logs viewer
- Test actions (queue test email, process queue, test order email)
- Troubleshooting guide
📝 Enhanced Debug Logging:
Added detailed logging to EmailManager:
- Hook trigger logging
- Order validation logging
- Event enabled/disabled logging
- Email rendering status
- wp_mail() call result
- Full email flow traceability
🎯 Usage:
1. Visit: /wp-content/plugins/woonoow/test-email-flow.php
2. Check all system status indicators
3. Use test buttons to trigger emails
4. Monitor debug logs for detailed flow
📋 Logs to Watch:
[EmailManager] send_order_processing_email triggered
[EmailManager] order_processing email is disabled/enabled
[EmailManager] Sending order_processing email
[EmailManager] Email rendered successfully
[EmailManager] wp_mail called - Result: success/failed
[WooNooW MailQueue] Queued email ID
[WooNooW MailQueue] Processing email_id
[WooNooW MailQueue] Sent and deleted email ID
🚀 Troubleshooting Steps:
1. Check notification system mode (woonoow vs woocommerce)
2. Check email channel enabled
3. Check event-specific email enabled
4. Check Action Scheduler for failures
5. Check debug logs for flow
6. Test with diagnostic tool
|
2025-11-18 15:44:08 +07:00 |
|
dwindown
|
60658c6786
|
feat: Complete backend wiring for notification system
✅ Global System Toggle:
- Added GET/POST /notifications/system-mode endpoints
- Switch between WooNooW and WooCommerce notification systems
- Stored in: woonoow_notification_system_mode
- EmailManager::is_enabled() checks system mode
- NotificationManager checks mode before sending
✅ Template System Wired:
- Templates saved via API are used when sending
- EmailRenderer fetches templates from TemplateProvider
- Variables replaced automatically
- Markdown parsed (cards, buttons, images)
- Email customization applied (colors, logo, branding)
✅ Channel Toggle Wired:
- Frontend toggles saved to database
- NotificationManager::is_channel_enabled() checks before sending
- Email: woonoow_email_notifications_enabled
- Push: woonoow_push_notifications_enabled
✅ Event Toggle Wired:
- Per-event channel settings saved
- NotificationManager::is_event_channel_enabled() checks before sending
- Stored in: woonoow_notification_settings
✅ Email Sending Flow:
Event → EmailManager → Check System Mode → Check Channel Toggle
→ Check Event Toggle → EmailRenderer → Get Template → Replace Variables
→ Parse Markdown → Apply Branding → wp_mail() → Sent
✅ All Settings Applied:
- Template modifications saved and used
- Channel toggles respected
- Event toggles respected
- Global system mode respected
- Email customization applied
- Push settings applied
📋 Modified Files:
- NotificationsController.php: Added system-mode endpoints
- NotificationManager.php: Added system mode check, wired EmailRenderer
- EmailManager.php: Added is_enabled() check for system mode
🎯 Result: Complete end-to-end notification system fully functional
|
2025-11-15 21:59:46 +07:00 |
|
dwindown
|
30384464a1
|
feat: Custom email system foundation
## ✅ Step 1-3: Email System Core
### EmailManager.php
- ✅ Disables WooCommerce emails (prevents duplicates)
- ✅ Hooks into all WC order status changes
- ✅ Hooks into customer, product events
- ✅ Checks if events are enabled before sending
- ✅ Sends via wp_mail() (SMTP plugin compatible)
### EmailRenderer.php
- ✅ Renders emails with design templates
- ✅ Variable replacement system
- ✅ Gets recipient email (staff/customer)
- ✅ Loads order/product/customer variables
- ✅ Filter hook: `woonoow_email_template`
- ✅ Supports HTML template designs
### Email Design Templates (3)
**templates/emails/modern.html**
- ✅ Clean, minimalist, Apple-inspired
- ✅ Dark mode support
- ✅ Mobile responsive
- ✅ 2024 design trends
**templates/emails/classic.html**
- ✅ Professional, traditional
- ✅ Gradient header
- ✅ Table styling
- ✅ Business-appropriate
**templates/emails/minimal.html**
- ✅ Ultra-clean, monospace font
- ✅ Black & white aesthetic
- ✅ Text-focused
- ✅ Dark mode invert
### Architecture
```
Design Template (HTML) → Content Template (Text) → Final Email
modern.html → order_processing → Beautiful HTML
```
---
**Next:** Rich text editor + Content templates 🎨
|
2025-11-12 18:48:55 +07:00 |
|