Replaces JSON textarea with professional Excel-like spreadsheet interface for managing product variant properties. Features: - Handsontable 14.6.1 spreadsheet component - Property presets (Size, Color, Material, Storage, Custom) - Inline cell editing with Tab/Enter navigation - Context menu for add/remove rows and columns - Keyboard shortcuts (Ctrl+D delete, Ctrl+Enter save, Ctrl+Z undo) - Mobile touch gestures (swipe to delete rows) - Automatic JSON serialization on form submit - Form validation before saving - Comprehensive user guide documentation Files Changed: - LittleShop/package.json: NPM package management setup - LittleShop/wwwroot/js/variant-editor.js: 400-line spreadsheet editor module - LittleShop/wwwroot/lib/handsontable/: Handsontable library (Community Edition) - LittleShop/wwwroot/lib/hammerjs/: Hammer.js touch gesture library - LittleShop/Areas/Admin/Views/VariantCollections/Edit.cshtml: Spreadsheet UI integration - VARIANT_COLLECTIONS_USER_GUIDE.md: Complete user guide (18+ pages) Technical Details: - Excel-like editing experience (no more manual JSON editing) - Mobile-first responsive design - Browser compatibility: Chrome 90+, Firefox 88+, Edge 90+, Safari 14+ - Touch-optimized for mobile administration - Automatic data validation and error handling
14 KiB
Variant Collections Spreadsheet Editor - User Guide
Professional spreadsheet interface for managing product variant properties with mobile-first design
Overview
The Variant Collections Spreadsheet Editor replaces the traditional JSON textarea with a professional, Excel-like spreadsheet interface powered by Handsontable. This makes it significantly easier to create and manage complex product variant configurations without manually writing JSON.
Key Features
✨ Core Functionality
- Excel-like Interface: Familiar spreadsheet editing experience
- Property Presets: Pre-configured property types (Size, Color, Material, Storage, Custom)
- Inline Editing: Click any cell to edit values directly
- Dynamic Rows/Columns: Add or remove rows and columns on-the-fly
- Auto-save: Changes automatically serialize to JSON on form submission
- Mobile Optimized: Touch gestures and responsive design for mobile devices
📱 Mobile Features
- Touch Gestures: Swipe left/right on rows to delete
- Responsive Layout: Adapts to screen size automatically
- Large Touch Targets: Easy to interact with on mobile devices
⌨️ Keyboard Shortcuts
- Tab: Move to next cell (right)
- Shift+Tab: Move to previous cell (left)
- Enter: Move down to next row
- Ctrl+D: Delete selected rows or columns
- Ctrl+Enter: Save form immediately
- Ctrl+Z: Undo last action
- Ctrl+Y: Redo last undone action
Getting Started
Accessing the Editor
- Navigate to Admin Panel → Variants → Variant Collections
- Click Create New or Edit on an existing collection
- The spreadsheet editor appears under "Properties Spreadsheet"
Creating Your First Variant Collection
Example: Creating a Clothing Size/Color Variant
- Set Collection Name: Enter "Clothing Variants" in the Collection Name field
- Configure Properties:
- Column 1 (Size): Click the first column header → Select "Size" → Pre-populated with XS, S, M, L, XL, XXL
- Column 2 (Color): Click the second column header → Select "Color" → Pre-populated with Black, White, Red, Blue, etc.
- Edit Values: Click any cell to modify or add custom values
- Save: Click "Save Changes" at the bottom (or press Ctrl+Enter)
Property Types
1. Size (Preset)
Pre-configured with standard clothing sizes:
- XS, S, M, L, XL, XXL
Use Cases:
- Clothing items
- Shoe sizes (edit values to match your sizing system)
- General size categories
2. Color (Preset)
Pre-configured with common colors:
- Black, White, Red, Blue, Green, Yellow, Pink, Purple, Gray, Brown
Use Cases:
- Clothing colors
- Product variants with color options
- Packaging color variations
3. Material (Preset)
Pre-configured with fabric/material types:
- Cotton, Polyester, Silk, Wool, Leather, Denim, Linen
Use Cases:
- Clothing materials
- Product composition
- Manufacturing materials
4. Storage (Preset)
Pre-configured with common storage capacities:
- 16GB, 32GB, 64GB, 128GB, 256GB, 512GB, 1TB
Use Cases:
- Electronics (phones, tablets, laptops)
- Storage devices
- Memory cards
5. Custom (Freeform)
Create your own property type with custom name and values.
Use Cases:
- Specialty product attributes
- Unique variant properties
- Industry-specific classifications
Common Use Cases
Use Case 1: Electronics Store (Phones)
Scenario: Sell smartphones with storage and color variants
Collection Name: Smartphone Variants
Property 1: Storage (16GB, 32GB, 64GB, 128GB, 256GB)
Property 2: Color (Space Gray, Silver, Gold, Rose Gold)
Steps:
- Click first column header → Select "Storage"
- Edit cells to keep only: 64GB, 128GB, 256GB (delete others if not needed)
- Click second column header → Select "Color"
- Edit cells to: Space Gray, Silver, Gold, Rose Gold
- Click "Add Row" (right-click menu) if you need more color options
- Save collection
Use Case 2: Clothing Store (Apparel)
Scenario: Sell t-shirts with size and color variants
Collection Name: T-Shirt Variants
Property 1: Size (S, M, L, XL, XXL)
Property 2: Color (Black, White, Navy, Red)
Steps:
- Click first column header → Select "Size"
- Keep S, M, L, XL, XXL (delete XS if not needed)
- Click second column header → Select "Color"
- Edit to: Black, White, Navy, Red
- Save collection
Use Case 3: Jewelry Store (Rings)
Scenario: Sell rings with material and ring size variants
Collection Name: Ring Variants
Property 1: Material (Gold, Silver, Platinum, Rose Gold)
Property 2: Ring Size (6, 7, 8, 9, 10)
Steps:
- Click first column header → Select "Material"
- Edit cells to: Gold, Silver, Platinum, Rose Gold
- Click second column header → Select "Custom..."
- Enter "Ring Size" as custom property name
- Enter sizes: 6, 7, 8, 9, 10 in cells
- Save collection
Use Case 4: Book Store (Formats)
Scenario: Sell books in different formats
Collection Name: Book Format
Property 1: Format (Hardcover, Paperback, eBook, Audiobook)
Steps:
- Click first column header → Select "Custom..."
- Enter "Format" as property name
- Enter: Hardcover, Paperback, eBook, Audiobook
- Save collection (single-property variant)
Advanced Techniques
Adding Multiple Columns
You can create variants with up to 8 properties (columns):
- Click the rightmost column header
- Right-click → Select "Insert column right"
- Configure the new column with a property type
- Repeat as needed
Example: Complex Electronics Variant
Property 1: Storage (64GB, 128GB, 256GB)
Property 2: Color (Black, White, Blue)
Property 3: Memory (4GB RAM, 8GB RAM, 16GB RAM)
Property 4: Screen Size (6.1", 6.5", 6.7")
Bulk Editing
For efficiency when editing many values:
- Copy/Paste: Use Ctrl+C and Ctrl+V to copy cell values
- Fill Down: Select a cell, drag the fill handle (bottom-right corner) down to replicate values
- Multi-Select: Click and drag to select multiple cells, then type to replace all
Deleting Unwanted Data
Delete Individual Rows:
- Desktop: Right-click row header → "Remove row"
- Mobile: Swipe row left or right → Confirm delete
- Keyboard: Select row → Press Ctrl+D
Delete Columns:
- Right-click column header → "Remove column"
- Or select column and press Ctrl+D
Clear Cell Contents:
- Click cell → Press Delete key
- Or select cells → Right-click → "Clear selected"
Mobile Usage Tips
Touch Navigation
- Tap: Select cell for editing
- Double-tap: Enter edit mode
- Swipe left/right: Delete row (with confirmation)
- Pinch zoom: Not needed - layout auto-adjusts
Mobile-Specific Features
- Larger touch targets: Cells are sized for finger taps
- Horizontal scrolling: Swipe left/right to see more columns
- Full-screen mode: Rotate device to landscape for better view
Data Validation and Error Handling
Automatic Validation
The editor performs validation before saving:
- Empty Property Names: All columns must have names (click headers to set)
- Valid JSON: Data must serialize to valid JSON format
- Array Structure: Properties must have array structure
Common Errors
Error: "All property columns must have names"
Cause: One or more columns don't have property names set
Solution: Click each column header and select a property type or enter custom name
Error: "Failed to save variant properties"
Cause: Invalid data structure or JSON serialization failure
Solution:
- Check for special characters in cell values
- Ensure all columns have names
- Try refreshing the page and re-entering data
Best Practices
1. Plan Your Variant Structure
Before creating a variant collection:
- List all property types you need
- Identify which properties have fixed values vs. freeform text
- Consider how many variants this will create (combinations multiply)
Example:
- 3 Sizes × 4 Colors = 12 variant combinations
- 5 Storage options × 3 Colors × 2 Memory sizes = 30 combinations
2. Use Presets When Possible
Presets save time and ensure consistency:
- Use "Size" preset for standard clothing sizes
- Use "Color" preset for common colors
- Use "Storage" preset for electronics
3. Keep Property Names Clear
Use descriptive property names that customers will understand:
- ✅ "Ring Size" instead of "Size"
- ✅ "Frame Material" instead of "Material"
- ✅ "Battery Capacity" instead of "Storage"
4. Organize Properties Logically
Order properties from most to least important:
- Primary differentiator (e.g., Storage, Size)
- Secondary attributes (e.g., Color)
- Optional features (e.g., Memory, Screen Size)
5. Test Your Variants
After creating a variant collection:
- Save the collection
- Assign it to a product
- Edit the product and verify variants are generated correctly
- Check product display on the store front
Troubleshooting
Issue: Spreadsheet Not Loading
Symptoms: Blank area where spreadsheet should appear
Solutions:
- Check browser console for JavaScript errors (F12)
- Ensure you're using a modern browser (Chrome, Firefox, Edge, Safari)
- Clear browser cache and reload page
- Verify Handsontable libraries are loaded (check Network tab)
Issue: Changes Not Saving
Symptoms: Click "Save Changes" but data reverts
Solutions:
- Check for validation errors (red alert boxes)
- Ensure all columns have property names set
- Check browser console for error messages
- Try manually clicking in each cell to trigger validation
Issue: Context Menu Not Appearing
Symptoms: Right-click doesn't show menu
Solutions:
- Ensure you're right-clicking on the grid area (not outside)
- Try on different cell locations
- Use keyboard shortcuts as alternative (Ctrl+D, etc.)
- Check if browser is blocking context menus
Issue: Mobile Gestures Not Working
Symptoms: Swipe gestures don't delete rows
Solutions:
- Ensure Hammer.js library is loaded
- Try swiping with more force/distance
- Use desktop context menu as alternative
- Check if device/browser supports touch events
Technical Details
JSON Format
The spreadsheet automatically converts to this JSON structure:
[
{
"name": "Size",
"values": ["S", "M", "L", "XL"]
},
{
"name": "Color",
"values": ["Black", "White", "Red"]
}
]
Freeform Properties
To create a freeform property (no predefined values):
- Select "Custom" property type
- Leave all cell values empty
- Customers will be able to enter any text value
JSON Example:
[
{
"name": "Custom Text",
"values": null
}
]
Browser Compatibility
Fully Supported:
- Chrome 90+
- Firefox 88+
- Edge 90+
- Safari 14+
- Mobile Safari (iOS 13+)
- Chrome Mobile (Android 8+)
Limited Support:
- IE 11 (basic functionality, no touch gestures)
- Older Android browsers (may have touch issues)
Keyboard Reference Card
| Shortcut | Action |
|---|---|
| Navigation | |
| Tab | Move right |
| Shift+Tab | Move left |
| Enter | Move down |
| Shift+Enter | Move up |
| Arrow Keys | Navigate cells |
| Home | First column |
| End | Last column |
| Editing | |
| F2 | Edit cell |
| Delete | Clear cell |
| Backspace | Clear and edit |
| Escape | Cancel edit |
| Selection | |
| Shift+Arrows | Extend selection |
| Ctrl+A | Select all |
| Operations | |
| Ctrl+C | Copy |
| Ctrl+V | Paste |
| Ctrl+X | Cut |
| Ctrl+Z | Undo |
| Ctrl+Y | Redo |
| Ctrl+D | Delete selected |
| Ctrl+Enter | Save form |
Support and Feedback
Getting Help
If you encounter issues not covered in this guide:
- Check Browser Console: Press F12 and look for error messages in the Console tab
- Review Validation Messages: Red alert boxes show specific error details
- Test in Different Browser: Some issues may be browser-specific
Feature Requests
To request new features or report bugs:
- Document the issue with screenshots
- Include browser version and device information
- Describe expected vs. actual behavior
Appendix: Example Configurations
Electronics Store (Complete Setup)
Collection 1: Smartphone Variants
- Storage: 64GB, 128GB, 256GB, 512GB
- Color: Midnight, Starlight, Blue, Red, Green
Collection 2: Laptop Variants
- Processor: i5, i7, i9
- RAM: 8GB, 16GB, 32GB
- Storage: 256GB SSD, 512GB SSD, 1TB SSD
Fashion Store (Complete Setup)
Collection 1: Clothing Variants
- Size: XS, S, M, L, XL, XXL
- Color: Black, White, Navy, Gray, Olive
Collection 2: Shoe Variants
- Size: 7, 8, 9, 10, 11, 12
- Width: Narrow, Regular, Wide
Collection 3: Accessories Variants
- One Size: Fits Most
- Color: Black, Brown, Tan
Specialty Store (Complete Setup)
Collection 1: Custom Engraving Products
- Material: Silver, Gold, Platinum
- Size: Small, Medium, Large
- Engraving: (freeform - leave values empty)
Collection 2: Made-to-Order Furniture
- Wood Type: Oak, Walnut, Maple, Cherry
- Finish: Natural, Stained, Painted
- Dimensions: (freeform - custom dimensions)
Quick Start Summary
- Navigate to Admin → Variants → Create/Edit Collection
- Name your collection (e.g., "Clothing Variants")
- Click column headers to select property types
- Edit cells to customize values
- Add/remove rows and columns as needed
- Save your collection (Ctrl+Enter)
- Assign collection to products
- Test by editing a product and viewing variants
That's it! You now have a professional variant collection system without writing a single line of JSON.
Last Updated: November 13, 2025 LittleShop Admin Panel - Phase 2.5