Skip to content

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.

Minor fix for Minimum quantity warning appearance - #89

PatrykPorabik06affc4bbb6a
diff --git a/src/Web/Grand.Web/Views/Product/_AddToCart.cshtml b/src/Web/Grand.Web/Views/Product/_AddToCart.cshtml
index 06d96e7b8..2cec23004 100644
--- a/src/Web/Grand.Web/Views/Product/_AddToCart.cshtml
+++ b/src/Web/Grand.Web/Views/Product/_AddToCart.cshtml
@@ -1,5 +1,5 @@
@model ProductDetailsModel.AddToCartModel
-@{
+@{
var shoppingCartType = Model.UpdateShoppingCartItemType.HasValue ? Model.UpdateShoppingCartItemType.Value : ShoppingCartType.ShoppingCart;
}
@if (!String.IsNullOrEmpty(Model.UpdatedShoppingCartItemId))
@@ -18,15 +18,15 @@
</div>
</div>
}
-<div role="group" class="input-group product-add-to-cart flex-nowrap">
@if (!Model.DisableBuyButton || Model.EnteredPrice)
{
if (!String.IsNullOrEmpty(Model.MinimumQuantityNotification))
{
<div class="min-qty-notification text-danger w-100 mb-2">@Model.MinimumQuantityNotification</div>
}
- if (!Model.DisableBuyButton)
- {
+ <div role="group" class="input-group product-add-to-cart flex-nowrap">
+ @if (!Model.DisableBuyButton)
+ {
@if (Model.AllowedQuantities.Any())
{
<select asp-for="EnteredQuantity" asp-items="Model.AllowedQuantities" class="custom-select form-control qty-dropdown mr-2"></select>
@@ -42,7 +42,7 @@
var addId = "addtocart_" + @Model.ProductId + "_EnteredQuantity";
<label for="@addId" class="sr-only">@Loc["ShoppingCart.AddToCart"]</label>
- <input asp-for="EnteredQuantity" class="qty-input form-control text-center" type="number" inputmode="numeric"/>
+ <input asp-for="EnteredQuantity" class="qty-input form-control text-center" type="number" inputmode="numeric" />
if (!String.IsNullOrEmpty(Model.MeasureUnit))
{
<span class="qty-unit d-flex align-items-center mr-2">
@@ -52,29 +52,29 @@
}
{
- 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"];
- }
- }
+ 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"];
+ }
+ }
- <script asp-location="Footer">
+ <script asp-location="Footer">
if (document.getElementById("@Html.IdFor(model => model.EnteredQuantity)")) {
document.getElementById("@Html.IdFor(model => model.EnteredQuantity)").addEventListener("keyup", function (event) {
if (event.keyCode == 13) {
@@ -92,13 +92,14 @@
});
}
- </script>
- <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" onclick="AxiosCart.addproducttocart_details('@Url.RouteUrl("AddProductDetails", new { productId = Model.ProductId, shoppingCartTypeId = (int)shoppingCartType })', '#product-details-form');return false;">
- <span>@addToCartText</span>
- </button>
- </div>
+ </script>
+ <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" onclick="AxiosCart.addproducttocart_details('@Url.RouteUrl("AddProductDetails", new { productId = Model.ProductId, shoppingCartTypeId = (int)shoppingCartType })', '#product-details-form');return false;">
+ <span>@addToCartText</span>
+ </button>
+ </div>
}
- }
-}
-</div>
+ }
+
+ </div>
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Views/Shared/_AddToCartGroupQV.cshtml b/src/Web/Grand.Web/Views/Shared/_AddToCartGroupQV.cshtml
index a5ca878ab..da953c984 100644
--- a/src/Web/Grand.Web/Views/Shared/_AddToCartGroupQV.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/_AddToCartGroupQV.cshtml
@@ -9,12 +9,12 @@
</div>
</div>
</template>
-<div role="group" class="input-group product-add-to-cart flex-nowrap">
- <template v-if="!variant.AddToCart.DisableBuyButton || variant.AddToCart.EnteredPrice">
- <template v-if="variant.AddToCart.MinimumQuantityNotification !== null">
- <div class="min-qty-notification text-danger w-100 mb-2">{{variant.AddToCart.MinimumQuantityNotification}}</div>
- </template>
+<template v-if="!variant.AddToCart.DisableBuyButton || variant.AddToCart.EnteredPrice">
+ <template v-if="variant.AddToCart.MinimumQuantityNotification !== null">
+ <div class="min-qty-notification text-danger w-100 mb-2">{{variant.AddToCart.MinimumQuantityNotification}}</div>
</template>
+</template>
+<div role="group" class="input-group product-add-to-cart flex-nowrap">
<template v-if="!variant.AddToCart.DisableBuyButton">
<template v-if="variant.AddToCart.AllowedQuantities.length > 0">
<select :id="'addtocart_' + variant.AddToCart.ProductId + '_EnteredQuantity'" :name="'addtocart_' + variant.AddToCart.ProductId + '.EnteredQuantity'" class="custom-select form-control qty-dropdown mr-2">
diff --git a/src/Web/Grand.Web/Views/Shared/_AddToCartQV.cshtml b/src/Web/Grand.Web/Views/Shared/_AddToCartQV.cshtml
index b5a9fbd60..87171b7e4 100644
--- a/src/Web/Grand.Web/Views/Shared/_AddToCartQV.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/_AddToCartQV.cshtml
@@ -1,4 +1,4 @@
-@{
+@{
var addtocart = @Url.RouteUrl("AddProductDetails");
}
<template v-if="PopupQuickViewVueModal.AddToCart.EnteredPrice">
@@ -12,12 +12,12 @@
</div>
</div>
</template>
-<div role="group" class="input-group product-add-to-cart flex-nowrap">
- <template v-if="!PopupQuickViewVueModal.AddToCart.DisableBuyButton || PopupQuickViewVueModal.AddToCart.EnteredPrice">
- <template v-if="PopupQuickViewVueModal.AddToCart.MinimumQuantityNotification !== null">
- <div class="min-qty-notification text-danger w-100 mb-2">{{PopupQuickViewVueModal.AddToCart.MinimumQuantityNotification}}</div>
- </template>
+<template v-if="!PopupQuickViewVueModal.AddToCart.DisableBuyButton || PopupQuickViewVueModal.AddToCart.EnteredPrice">
+ <template v-if="PopupQuickViewVueModal.AddToCart.MinimumQuantityNotification !== null">
+ <div class="min-qty-notification text-danger w-100 mb-2">{{PopupQuickViewVueModal.AddToCart.MinimumQuantityNotification}}</div>
</template>
+</template>
+<div role="group" class="input-group product-add-to-cart flex-nowrap">
<template v-if="!PopupQuickViewVueModal.AddToCart.DisableBuyButton">
<template v-if="PopupQuickViewVueModal.AddToCart.AllowedQuantities.length > 0">
<select :id="'addtocart_' + PopupQuickViewVueModal.AddToCart.ProductId + '_EnteredQuantity'" :name="'addtocart_' + PopupQuickViewVueModal.AddToCart.ProductId + '.EnteredQuantity'" class="custom-select form-control qty-dropdown mr-2">