feat: product page layout toggle (flat/card), fix email shortcode rendering
- Add layout_style setting (flat default) to product appearance
- AppearanceController: sanitize & persist layout_style, add to default settings
- Admin SPA: Layout Style select in Appearance > Product
- Customer SPA: useEffect targets <main> bg-white in flat mode (full-width),
card mode uses per-section white floating cards on gray background
- Accordion sections styled per mode: flat=border-t dividers, card=white cards
- Fix email shortcode gaps (EmailRenderer, EmailManager)
- Add missing variables: return_url, contact_url, account_url (alias),
payment_error_reason, order_items_list (alias for order_items_table)
- Fix customer_note extra_data key mismatch (note → customer_note)
- Pass low_stock_threshold via extra_data in low_stock email send
This commit is contained in:
@@ -1,41 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php wp_title('|', true, 'right'); ?><?php bloginfo('name'); ?></title>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class('woonoow-spa-page'); ?>>
|
||||
<?php
|
||||
// Determine initial route based on SPA mode
|
||||
$appearance_settings = get_option('woonoow_appearance_settings', []);
|
||||
$spa_mode = isset($appearance_settings['general']['spa_mode']) ? $appearance_settings['general']['spa_mode'] : 'full';
|
||||
|
||||
|
||||
// Get actual request path for accurate routing
|
||||
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
|
||||
$current_path = parse_url($request_uri, PHP_URL_PATH);
|
||||
|
||||
// Set initial page based on mode
|
||||
if ($spa_mode === 'checkout_only') {
|
||||
// Checkout Only mode starts at cart
|
||||
$page_type = 'cart';
|
||||
$data_attrs = 'data-page="cart" data-initial-route="/cart"';
|
||||
} else {
|
||||
// Full SPA mode starts at shop
|
||||
$page_type = 'shop';
|
||||
|
||||
// Evaluate WordPress page type to pass to React App
|
||||
if (is_product()) {
|
||||
global $post;
|
||||
$data_attrs = 'data-page="product" data-product-id="' . esc_attr($post->ID) . '"';
|
||||
} elseif (is_cart()) {
|
||||
$data_attrs = 'data-page="cart"';
|
||||
} elseif (is_checkout()) {
|
||||
$data_attrs = 'data-page="checkout"';
|
||||
} elseif (is_account_page()) {
|
||||
$data_attrs = 'data-page="account"';
|
||||
} elseif (is_singular('page')) {
|
||||
$data_attrs = 'data-page="page"';
|
||||
} elseif (is_singular() && !is_singular('page')) {
|
||||
global $post;
|
||||
$post_type = get_post_type();
|
||||
$data_attrs = 'data-page="cpt" data-cpt-type="' . esc_attr($post_type) . '" data-cpt-slug="' . esc_attr($post->post_name) . '"';
|
||||
} else {
|
||||
$data_attrs = 'data-page="shop"';
|
||||
}
|
||||
|
||||
// If this is the front page, route to /
|
||||
if (is_front_page()) {
|
||||
$data_attrs = 'data-page="shop" data-initial-route="/"';
|
||||
$data_attrs .= ' data-initial-route="/"';
|
||||
} else {
|
||||
$data_attrs = 'data-page="shop" data-initial-route="/shop"';
|
||||
$data_attrs .= ' data-initial-route="' . esc_attr($current_path) . '"';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<div id="woonoow-customer-app" <?php echo $data_attrs; ?>>
|
||||
<div class="woonoow-loading" style="display: flex; align-items: center; justify-content: center; min-height: 100vh; font-family: system-ui, -apple-system, sans-serif;">
|
||||
<p><?php esc_html_e('Loading...', 'woonoow'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user