@model SkyArtShop.Models.Product @{ ViewData["Title"] = Model.Name; }

@Model.Name

@if (!string.IsNullOrEmpty(Model.ShortDescription)) {

@Model.ShortDescription

}
@if (!string.IsNullOrEmpty(Model.SKU)) { SKU: @Model.SKU } else if (!string.IsNullOrEmpty(Model.Category)) { SKU: @Model.Category.ToUpper().Replace(" ","")@Model.Id?.Substring(Model.Id.Length - 4) } @{ var rating = Model.AverageRating > 0 ? Model.AverageRating : 5.0; var fullStars = (int)Math.Floor(rating); var hasHalfStar = (rating - fullStars) >= 0.5; var emptyStars = 5 - fullStars - (hasHalfStar ? 1 : 0); }
@for (int i = 0; i < fullStars; i++) { } @if (hasHalfStar) { } @for (int i = 0; i < emptyStars; i++) { } (@Model.TotalReviews review@(Model.TotalReviews != 1 ? "s" : ""))
@if (Model.UnitsSold > 0) { @Model.UnitsSold sold }
Price: $@Model.Price.ToString("F2")
@if (Model.StockQuantity > 0) {
In stock (@Model.StockQuantity+ units), ready to be shipped
} else {
@if (Model.StockQuantity > 0) { } else { }
Out of stock
}
Quantity: @if (Model.StockQuantity > 0) { (@Model.StockQuantity available) }
@if (Model.StockQuantity > 0) { } else { }
@{ var hasVariants = Model.Variants != null && Model.Variants.Any(v => v.IsAvailable && v.Images != null && v.Images.Any()); var hasLegacyColors = (Model.Colors != null && Model.Colors.Any()) || !string.IsNullOrEmpty(Model.Color); if (hasVariants && Model.Variants != null) { // New variant system - filter only available variants with images var availableVariants = Model.Variants.Where(v => v.IsAvailable && v.Images != null && v.Images.Any()).ToList();
Select Color: Choose a color
@foreach (var variant in availableVariants) { var variantJson = System.Text.Json.JsonSerializer.Serialize(new { colorName = variant.ColorName, colorHex = variant.ColorHex, images = variant.Images, stock = variant.StockQuantity, priceAdjust = variant.PriceAdjustment, sku = variant.SKU });
@variant.ColorName @if (variant.StockQuantity <= 5 && variant.StockQuantity > 0) { Only @variant.StockQuantity left } @if (variant.StockQuantity == 0) { Out of Stock }
}
} @* Legacy color system removed - all products should use Variants *@ }
@if (!string.IsNullOrEmpty(Model.Description)) {
Description
@Html.Raw(Model.Description)
} @if (ViewBag.RelatedProducts != null && ViewBag.RelatedProducts.Count > 0) {

You May Also Like

Based on what customers are viewing

} else {

Explore Our Collection

Browse @Model.Category
}
@section Scripts { }