fix: resolve container width issues, spa redirects, and appearance settings overwrite. feat: enhance order/sub details and newsletter layout

This commit is contained in:
Dwindi Ramadhana
2026-02-05 00:09:40 +07:00
parent a0b5f8496d
commit 5f08c18ec7
77 changed files with 7027 additions and 4546 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Default Email Templates (DEPRECATED)
*
@@ -17,8 +18,9 @@ namespace WooNooW\Core\Notifications;
use WooNooW\Email\DefaultTemplates as NewDefaultTemplates;
class DefaultEmailTemplates {
class DefaultEmailTemplates
{
/**
* Get default template for an event and recipient type
*
@@ -26,28 +28,30 @@ class DefaultEmailTemplates {
* @param string $recipient_type 'staff' or 'customer'
* @return array ['subject' => string, 'body' => string]
*/
public static function get_template($event_id, $recipient_type) {
public static function get_template($event_id, $recipient_type)
{
// Get templates directly from this class
$allTemplates = self::get_all_templates();
// Check if event exists for this recipient type
if (isset($allTemplates[$event_id][$recipient_type])) {
return $allTemplates[$event_id][$recipient_type];
}
// Fallback
return [
'subject' => __('Notification from {store_name}', 'woonoow'),
'body' => '[card]' . __('You have a new notification.', 'woonoow') . '[/card]',
];
}
/**
* Get all default templates (legacy method - kept for backwards compatibility)
*
* @return array
*/
private static function get_all_templates() {
private static function get_all_templates()
{
// This method is now deprecated but kept for backwards compatibility
// Use WooNooW\Email\DefaultTemplates instead
return [
@@ -83,7 +87,7 @@ class DefaultEmailTemplates {
[button url="{order_url}" style="solid"]' . __('View Order Details', 'woonoow') . '[/button]',
],
],
'order_processing' => [
'customer' => [
'subject' => __('Your Order #{order_number} is Being Processed', 'woonoow'),
@@ -112,7 +116,7 @@ class DefaultEmailTemplates {
[button url="{order_url}" style="solid"]' . __('Track Your Order', 'woonoow') . '[/button]',
],
],
'order_completed' => [
'customer' => [
'subject' => __('Your Order #{order_number} is Complete', 'woonoow'),
@@ -135,10 +139,10 @@ class DefaultEmailTemplates {
[/card]
[button url="{order_url}" style="solid"]' . __('View Order', 'woonoow') . '[/button]
[button url="{store_url}" style="outline"]' . __('Continue Shopping', 'woonoow') . '[/button]',
[button url="{shop_url}" style="outline"]' . __('Continue Shopping', 'woonoow') . '[/button]',
],
],
'order_cancelled' => [
'staff' => [
'subject' => __('Order #{order_number} Cancelled', 'woonoow'),
@@ -158,7 +162,7 @@ class DefaultEmailTemplates {
[button url="{order_url}" style="solid"]' . __('View Order Details', 'woonoow') . '[/button]',
],
],
'order_refunded' => [
'customer' => [
'subject' => __('Your Order #{order_number} Has Been Refunded', 'woonoow'),
@@ -183,7 +187,7 @@ class DefaultEmailTemplates {
[button url="{order_url}" style="solid"]' . __('View Order', 'woonoow') . '[/button]',
],
],
// PRODUCT EVENTS
'low_stock' => [
'staff' => [
@@ -209,7 +213,7 @@ class DefaultEmailTemplates {
[button url="{product_url}" style="solid"]' . __('View Product', 'woonoow') . '[/button]',
],
],
'out_of_stock' => [
'staff' => [
'subject' => __('Out of Stock Alert: {product_name}', 'woonoow'),
@@ -233,7 +237,7 @@ class DefaultEmailTemplates {
[button url="{product_url}" style="solid"]' . __('Manage Product', 'woonoow') . '[/button]',
],
],
// CUSTOMER EVENTS
'new_customer' => [
'customer' => [
@@ -261,10 +265,10 @@ class DefaultEmailTemplates {
[/card]
[button url="{account_url}" style="solid"]' . __('Go to My Account', 'woonoow') . '[/button]
[button url="{store_url}" style="outline"]' . __('Start Shopping', 'woonoow') . '[/button]',
[button url="{shop_url}" style="outline"]' . __('Start Shopping', 'woonoow') . '[/button]',
],
],
'customer_note' => [
'customer' => [
'subject' => __('Note Added to Your Order #{order_number}', 'woonoow'),
@@ -289,16 +293,17 @@ class DefaultEmailTemplates {
],
];
}
/**
* Get all new templates (direct access to new class)
*
* @return array
*/
public static function get_new_templates() {
public static function get_new_templates()
{
return NewDefaultTemplates::get_all_templates();
}
/**
* Get default subject from new templates
*
@@ -306,7 +311,8 @@ class DefaultEmailTemplates {
* @param string $event_id Event ID
* @return string
*/
public static function get_default_subject($recipient_type, $event_id) {
public static function get_default_subject($recipient_type, $event_id)
{
return NewDefaultTemplates::get_default_subject($recipient_type, $event_id);
}
}