Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@model ProductDetailsModel.AddToCartModel
@{
var shoppingCartType = Model.UpdateShoppingCartItemType ?? ShoppingCartType.ShoppingCart;
}
@if (!string.IsNullOrEmpty(Model.UpdatedShoppingCartItemId))
{
<input asp-for="UpdatedShoppingCartItemId" type="hidden"/>
}
@if (Model.EnteredPrice)
{
<div class="customer-entered-price mb-3 d-flex w-100 flex-column">
<div class="price-input">
<label for=@($"CustomerEnteredPrice_{Model.ProductId}") class="enter-price-label">@Loc["Products.EnterProductPrice"]</label>
<input type="text" id=@($"CustomerEnteredPrice_{Model.ProductId}") name="CustomerEnteredPrice" value="@Convert.ToInt32(Math.Ceiling(Model.CustomerEnteredPrice))" class="form-control enter-price-input"/>
</div>
<div class="price-range pt-1">
@Model.CustomerEnteredPriceRange
</div>
</div>
}
@if (!Model.DisableBuyButton || Model.EnteredPrice)
{
if (!string.IsNullOrEmpty(Model.MinimumQuantityNotification))
{
<div class="min-qty-notification text-danger w-100 mb-2">@Model.MinimumQuantityNotification</div>
}
<div role="group" class="input-group product-add-to-cart flex-nowrap">
@if (!Model.DisableBuyButton)
{
@if (Model.AllowedQuantities.Any())
{
<select name="EnteredQuantity" id=@($"EnteredQuantity_{Model.ProductId}") asp-items="Model.AllowedQuantities" class="form-select form-control qty-dropdown me-2"></select>
if (!string.IsNullOrEmpty(Model.MeasureUnit))
{
<span class="qty-unit d-flex align-items-center me-2">
@Model.MeasureUnit
</span>
}
}
else
{
<label for=@($"EnteredQuantity_{Model.ProductId}") class="visually-hidden">@Loc["ShoppingCart.AddToCart"]</label>
<input type="number" inputmode="numeric" id=@($"EnteredQuantity_{Model.ProductId}") name="EnteredQuantity" value="1" class="qty-input form-control text-center">
if (!string.IsNullOrEmpty(Model.MeasureUnit))
{
<span class="qty-unit d-flex align-items-center me-2">
@Model.MeasureUnit
</span>
}
}
var addToCartText = "";
if (!string.IsNullOrEmpty(Model.UpdatedShoppingCartItemId) && Model.UpdateShoppingCartItemType.HasValue && (Model.UpdateShoppingCartItemType.Value == ShoppingCartType.ShoppingCart || Model.UpdateShoppingCartItemType.Value == ShoppingCartType.OnHoldCart))
{
addToCartText = Loc["ShoppingCart.AddToCart.Update"];
}
else
{
addToCartText = Loc["ShoppingCart.AddToCart"];
}
if (Model.IsReservation)
{
addToCartText = Loc["ShoppingCart.Reservation"];
}
if (Model.AvailableForPreOrder)
{
addToCartText = Loc["ShoppingCart.PreOrder"];
}
if (Model.IsAuction)
{
addToCartText = Loc["ShoppingCart.BuyNow"];
}
<div class="input-group-append">
<button type="button" id="[email protected]" class="btn btn-info w-100 add-to-cart-button d-inline-flex" data-productid="@Model.ProductId" data-cart-action="add-details" data-url="@Url.RouteUrl("AddProductDetails", new { productId = Model.ProductId, shoppingCartTypeId = (int)shoppingCartType })" data-form="#product-details-form-@(Model.ProductId)">
<span>@addToCartText</span>
</button>
</div>
}
</div>
}