littleshop/LittleShop/Areas/Admin/Controllers
SysAdmin 9f7b2840af Fix: Populate existing variant panels with imported ProductVariant data
**Previous Approach (WRONG):**
- Created a separate table section to display ProductVariants
- User wanted data in the EXISTING collapsible panels, not a new section

**Proper Fix:**
- ProductImportService creates records in ProductVariants table
- Edit page's collapsible panels read from VariantsJson field (different system)
- Solution: Convert ProductVariants → VariantsJson format on page load

**Changes:**

1. **ProductsController.cs (Lines 105-115):**
   - Load ProductVariants from database
   - If VariantsJson empty but ProductVariants exist, convert them
   - Format: `[{Weight: "28g", Price: 700, StockQty: 100}, ...]`
   - JavaScript reads Price and StockQty to populate collapsible panel fields

2. **Edit.cshtml:**
   - Removed the extra table section
   - Existing collapsible panels now display imported data automatically

**Result:**
When you open Edit page, expand "Product Variants" → "Price, Stock & Weight Details",
the fields will be PRE-FILLED with your imported values (700, 100, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 18:05:18 +01:00
..
AccountController.cs Fix login: Make username parameter case-insensitive 2025-09-24 22:26:16 +01:00
ActivityController.cs Implement product multi-buys and variants system 2025-09-21 00:30:12 +01:00
BotActivityController.cs Add product variants system and live bot activity dashboard 2025-09-24 23:00:20 +01:00
BotRecoveryController.cs Implement comprehensive notification system for LittleShop 2025-09-19 16:17:24 +01:00
BotsController.cs Implement product variations, enhanced order workflow, mobile responsiveness, and product import system 2025-09-18 01:39:31 +01:00
CategoriesController.cs Debug: Add logging to Categories Edit POST action 2025-10-03 13:42:51 +01:00
DashboardController.cs Implement product multi-buys and variants system 2025-09-21 00:30:12 +01:00
MessagesController.cs Security: Fix critical vulnerabilities and implement security hardening 2025-09-19 11:56:12 +01:00
OrdersController.cs Add explicit antiforgery configuration and better error handling for UpdateStatus 2025-09-24 16:49:21 +01:00
ProductsController.cs Fix: Populate existing variant panels with imported ProductVariant data 2025-10-08 18:05:18 +01:00
ReviewsController.cs Initial commit of LittleShop project (excluding large archives) 2025-09-17 15:07:38 +01:00
ShippingRatesController.cs Security: Fix critical vulnerabilities and implement security hardening 2025-09-19 11:56:12 +01:00
SystemSettingsController.cs Deploy LittleShop to Hostinger with Docker and BunkerWeb 2025-09-24 13:00:17 +01:00
UsersController.cs Security: Fix critical vulnerabilities and implement security hardening 2025-09-19 11:56:12 +01:00
VariantCollectionsController.cs Add variant collections system and enhance ProductVariant with weight/stock tracking 2025-09-28 17:03:09 +01:00