Files
WooNooW/includes/Modules/WishlistSettings.php
Dwindi Ramadhana 4095d2a70c feat: Wishlist settings cleanup + Categories/Tags/Attributes CRUD pages
Wishlist Settings Cleanup:
- Removed wishlist_page setting (not needed for SPA architecture)
- Marked advanced features as 'Coming Soon' with disabled flag:
  * Wishlist Sharing
  * Back in Stock Notifications
  * Multiple Wishlists
- Added disabled prop support to SchemaField toggle component
- Kept only working features: guest wishlist, show in header, max items, add to cart button

Product Taxonomy CRUD Pages:
Built full CRUD interfaces for all three taxonomy types:

1. Categories (/products/categories):
   - Table view with search
   - Create/Edit dialog with name, slug, description
   - Delete with confirmation
   - Product count display
   - Parent category support

2. Tags (/products/tags):
   - Table view with search
   - Create/Edit dialog with name, slug, description
   - Delete with confirmation
   - Product count display

3. Attributes (/products/attributes):
   - Table view with search
   - Create/Edit dialog with label, slug, type, orderby
   - Delete with confirmation
   - Type selector (Select/Text)
   - Sort order selector (Custom/Name/ID)

All pages include:
- React Query for data fetching/mutations
- Toast notifications for success/error
- Loading states
- Empty states
- Responsive tables
- Dialog forms with validation

Files Modified:
- includes/Modules/WishlistSettings.php (removed page selector, marked advanced as coming soon)
- admin-spa/src/components/forms/SchemaField.tsx (added disabled prop)
- admin-spa/src/routes/Products/Categories.tsx (full CRUD)
- admin-spa/src/routes/Products/Tags.tsx (full CRUD)
- admin-spa/src/routes/Products/Attributes.tsx (full CRUD)
- admin-spa/src/components/nav/SubmenuBar.tsx (removed debug logging)
- admin-spa/dist/app.js (rebuilt)

Result:
 Wishlist settings now clearly show what's implemented vs coming soon
 Categories/Tags/Attributes pages fully functional
 Professional CRUD interfaces matching admin design
 All taxonomy management now in SPA
2025-12-26 23:43:40 +07:00

80 lines
2.9 KiB
PHP

<?php
/**
* Wishlist Module Settings
*
* @package WooNooW
*/
namespace WooNooW\Modules;
if (!defined('ABSPATH')) exit;
class WishlistSettings {
/**
* Initialize the settings
*/
public static function init() {
add_filter('woonoow/module_settings_schema', [__CLASS__, 'register_schema']);
}
/**
* Register wishlist settings schema
*/
public static function register_schema($schemas) {
$schemas['wishlist'] = [
'enable_guest_wishlist' => [
'type' => 'toggle',
'label' => __('Enable Guest Wishlists', 'woonoow'),
'description' => __('Allow non-logged-in users to create wishlists (stored in browser)', 'woonoow'),
'default' => true,
],
'show_in_header' => [
'type' => 'toggle',
'label' => __('Show Wishlist Icon in Header', 'woonoow'),
'description' => __('Display wishlist icon with item count in the header', 'woonoow'),
'default' => true,
],
'max_items_per_wishlist' => [
'type' => 'number',
'label' => __('Maximum Items Per Wishlist', 'woonoow'),
'description' => __('Limit the number of items in a wishlist (0 = unlimited)', 'woonoow'),
'default' => 0,
'min' => 0,
'max' => 1000,
],
'show_add_to_cart_button' => [
'type' => 'toggle',
'label' => __('Show "Add to Cart" on Wishlist Page', 'woonoow'),
'description' => __('Display add to cart button for each wishlist item', 'woonoow'),
'default' => true,
],
// Advanced features - Coming Soon
'enable_sharing' => [
'type' => 'toggle',
'label' => __('Enable Wishlist Sharing (Coming Soon)', 'woonoow'),
'description' => __('Allow users to share their wishlists via link - Feature not yet implemented', 'woonoow'),
'default' => false,
'disabled' => true,
],
'enable_email_notifications' => [
'type' => 'toggle',
'label' => __('Back in Stock Notifications (Coming Soon)', 'woonoow'),
'description' => __('Email users when wishlist items are back in stock - Feature not yet implemented', 'woonoow'),
'default' => false,
'disabled' => true,
],
'enable_multiple_wishlists' => [
'type' => 'toggle',
'label' => __('Enable Multiple Wishlists (Coming Soon)', 'woonoow'),
'description' => __('Allow users to create multiple named wishlists - Feature not yet implemented', 'woonoow'),
'default' => false,
'disabled' => true,
],
];
return $schemas;
}
}