diff --git a/LittleShop/Areas/Admin/Controllers/ProductsController.cs b/LittleShop/Areas/Admin/Controllers/ProductsController.cs index fe03970..d821c90 100644 --- a/LittleShop/Areas/Admin/Controllers/ProductsController.cs +++ b/LittleShop/Areas/Admin/Controllers/ProductsController.cs @@ -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[] diff --git a/LittleShop/Areas/Admin/Views/Products/Edit.cshtml b/LittleShop/Areas/Admin/Views/Products/Edit.cshtml index 697273e..3744982 100644 --- a/LittleShop/Areas/Admin/Views/Products/Edit.cshtml +++ b/LittleShop/Areas/Admin/Views/Products/Edit.cshtml @@ -317,6 +317,101 @@ + + @{ + var productVariants = ViewData["ProductVariants"] as IEnumerable; + } + @if (productVariants != null && productVariants.Any()) + { +
+
+
+ +
+
+
+

+ These variants were imported via text import format. + To manage them, use the Product Variants page + or re-import via Text Import. +

+ +
+ + + + + + + + + + + + + @foreach (var variant in productVariants.OrderBy(v => v.SortOrder)) + { + + + + + + + + + } + +
NameTypePriceStock LevelSort OrderStatus
@variant.Name + @variant.VariantType + + @if (variant.Price.HasValue) + { + £@variant.Price.Value.ToString("F2") + } + else + { + £@Model?.Price.ToString("F2") (base) + } + + @if (variant.StockLevel > 0) + { + @variant.StockLevel in stock + } + else + { + Out of stock + } + @variant.SortOrder + @if (variant.IsActive) + { + Active + } + else + { + Inactive + } +
+
+ +
+ Quick Summary: + Total variants: @productVariants.Count() | + Total stock: @productVariants.Sum(v => v.StockLevel) units | + Price range: £@productVariants.Where(v => v.Price.HasValue).Min(v => v.Price ?? 0).ToString("F2") - £@productVariants.Where(v => v.Price.HasValue).Max(v => v.Price ?? 0).ToString("F2") +
+
+
+
+ } +