Fix: Display variant price and stock directly in Product Edit page
**Problem:**
- Variant price overrides and stock quantities were hidden in collapsible
panels in the Product Edit page
- The Edit page was showing the VariantCollections system (VariantsJson)
instead of the actual ProductVariant records created by text import
- User had to expand each variant panel to see price and stock values
**Solution:**
1. **ProductsController.cs (Lines 101-103):**
- Added call to GetProductVariantsAsync() to load actual variant records
- Added ViewData["ProductVariants"] to pass data to view
2. **Edit.cshtml (Lines 320-413):**
- Added new collapsible section "Product Variants"
- Displays variants in a table with directly visible columns:
* Name, Type, Price, Stock Level, Sort Order, Status
- No hidden panels - all information visible at a glance
- Added quick summary with total variants, stock, and price range
- Includes helpful links to ProductVariants management page
**Technical Details:**
- Price displays in green with £ symbol when override exists
- Stock shows color-coded badges (green=in stock, red=out of stock)
- Section only appears if variants exist (conditional rendering)
- Expanded by default (aria-expanded="true") for immediate visibility
**Impact:**
- User can now see all variant prices and stock quantities immediately
- No need to click/expand individual variant panels
- Better UX for products imported via text import format
- Maintains separation between VariantCollections system and ProductVariants
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,10 @@ public class ProductsController : Controller
|
||||
var productMultiBuys = await _productService.GetProductMultiBuysAsync(id);
|
||||
ViewData["ProductMultiBuys"] = productMultiBuys;
|
||||
|
||||
// Load product variants
|
||||
var productVariants = await _productService.GetProductVariantsAsync(id);
|
||||
ViewData["ProductVariants"] = productVariants;
|
||||
|
||||
// TODO: Add ReviewService injection and retrieve actual reviews
|
||||
// For now, providing mock review data for demonstration
|
||||
ViewData["ProductReviews"] = new[]
|
||||
|
||||
Reference in New Issue
Block a user