feat: Add product images support with WP Media Library integration
- Add WP Media Library integration for product and variation images - Support images array (URLs) conversion to attachment IDs - Add images array to API responses (Admin & Customer SPA) - Implement drag-and-drop sortable images in Admin product form - Add image gallery thumbnails in Customer SPA product page - Initialize WooCommerce session for guest cart operations - Fix product variations and attributes display in Customer SPA - Add variation image field in Admin SPA Changes: - includes/Api/ProductsController.php: Handle images array, add to responses - includes/Frontend/ShopController.php: Add images array for customer SPA - includes/Frontend/CartController.php: Initialize WC session for guests - admin-spa/src/lib/wp-media.ts: Add openWPMediaGallery function - admin-spa/src/routes/Products/partials/tabs/GeneralTab.tsx: WP Media + sortable images - admin-spa/src/routes/Products/partials/tabs/VariationsTab.tsx: Add variation image field - customer-spa/src/pages/Product/index.tsx: Add gallery thumbnails display
This commit is contained in:
@@ -13,7 +13,7 @@ if ( ! defined('ABSPATH') ) exit;
|
||||
*/
|
||||
class NavigationRegistry {
|
||||
const NAV_OPTION = 'wnw_nav_tree';
|
||||
const NAV_VERSION = '1.0.0';
|
||||
const NAV_VERSION = '1.0.1'; // Bumped to add Customer SPA settings
|
||||
|
||||
/**
|
||||
* Initialize hooks
|
||||
@@ -29,6 +29,15 @@ class NavigationRegistry {
|
||||
* Build the complete navigation tree
|
||||
*/
|
||||
public static function build_nav_tree() {
|
||||
// Check if we need to rebuild (version mismatch)
|
||||
$cached = get_option(self::NAV_OPTION, []);
|
||||
$cached_version = $cached['version'] ?? '';
|
||||
|
||||
if ($cached_version === self::NAV_VERSION && !empty($cached['tree'])) {
|
||||
// Cache is valid, no need to rebuild
|
||||
return;
|
||||
}
|
||||
|
||||
// Base navigation tree (core WooNooW sections)
|
||||
$tree = self::get_base_tree();
|
||||
|
||||
@@ -182,6 +191,7 @@ class NavigationRegistry {
|
||||
['label' => __('Tax', 'woonoow'), 'mode' => 'spa', 'path' => '/settings/tax'],
|
||||
['label' => __('Customers', 'woonoow'), 'mode' => 'spa', 'path' => '/settings/customers'],
|
||||
['label' => __('Notifications', 'woonoow'), 'mode' => 'spa', 'path' => '/settings/notifications'],
|
||||
['label' => __('Customer SPA', 'woonoow'), 'mode' => 'spa', 'path' => '/settings/customer-spa'],
|
||||
['label' => __('Developer', 'woonoow'), 'mode' => 'spa', 'path' => '/settings/developer'],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user