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
Allow rendering only one Captcha on the product page
KrzysztofPajakb8e319f94df7
diff --git a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.csindex 397389d33..769fe9cc4 100644--- a/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs+++ b/src/Web/Grand.Web/Features/Handlers/Products/GetProductDetailsPageHandler.cs@@ -393,7 +393,10 @@ namespace Grand.Web.Features.Handlers.ProductsNotReturnable = product.NotReturnable,EmailAFriendEnabled = _catalogSettings.EmailAFriendEnabled,AskQuestionEnabled = _catalogSettings.AskQuestionEnabled,- AskQuestionOnProduct = _catalogSettings.AskQuestionOnProduct+ AskQuestionOnProduct = _catalogSettings.AskQuestionOnProduct,+ RenderCaptcha = _captchaSettings.Enabled && (_captchaSettings.ShowOnEmailProductToFriendPage+ || _captchaSettings.ShowOnProductReviewPage+ || _captchaSettings.ShowOnAskQuestionPage)};//automatically generate product description?diff --git a/src/Web/Grand.Web/Models/Catalog/ProductDetailsModel.cs b/src/Web/Grand.Web/Models/Catalog/ProductDetailsModel.csindex d2df41ba9..9637e8a66 100644--- a/src/Web/Grand.Web/Models/Catalog/ProductDetailsModel.cs+++ b/src/Web/Grand.Web/Models/Catalog/ProductDetailsModel.cs@@ -103,6 +103,7 @@ namespace Grand.Web.Models.Catalogpublic DateTime? EndTime { get; set; }public DateTime? EndTimeLocalTime { get; set; }public bool AuctionEnded { get; set; }+ public bool RenderCaptcha { get; set; }#region Nested Classespublic partial class ProductBreadcrumbModel : BaseModeldiff --git a/src/Web/Grand.Web/Views/Product/ProductLayout.Simple.cshtml b/src/Web/Grand.Web/Views/Product/ProductLayout.Simple.cshtmlindex 4f13f2839..e60d39b75 100644--- a/src/Web/Grand.Web/Views/Product/ProductLayout.Simple.cshtml+++ b/src/Web/Grand.Web/Views/Product/ProductLayout.Simple.cshtml@@ -97,7 +97,7 @@<partial name="_Codes" model="Model" /><!--delivery-->@if ((Model.FreeShippingNotificationEnabled && Model.IsFreeShipping) || !string.IsNullOrWhiteSpace(Model.DeliveryDate)- || Model.NotReturnable || Model.AdditionalShippingCharge > 0)+ || Model.NotReturnable || Model.AdditionalShippingCharge > 0){<partial name="_DeliveryInfo" model="Model" />}@@ -236,7 +236,11 @@<vc:related-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:related-products><vc:similar-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:similar-products><vc:recommended-products product-id="@Model.Id" product-thumb-picture-size="null"></vc:recommended-products>- </div>+ @if (Model.RenderCaptcha)+ {+ <partial name="_Captcha" />+ }+ </div></form></validation-observer><vc:widget widget-zone="productdetails_bottom" additional-data="@Model.Id"></vc:widget>diff --git a/src/Web/Grand.Web/Views/Product/_Captcha.cshtml b/src/Web/Grand.Web/Views/Product/_Captcha.cshtmlnew file mode 100644index 000000000..a27265bf0--- /dev/null+++ b/src/Web/Grand.Web/Views/Product/_Captcha.cshtml@@ -0,0 +1,5 @@+<div id="captcha-container">+ <div class="captcha-box" id="captcha-box">+ <captcha />+ </div>+</div>\ No newline at end of file