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.

Take the admin theme switch out of the store panel (#775)

Krzysztof Pajak9433e91041b4
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml
index 3d5fe2803..09f909412 100644
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml
+++ b/src/Web/Grand.Web.Store/Areas/Store/Views/Setting/Partials/GeneralCommon.TabStoreInformationSettings.cshtml
@@ -83,18 +83,6 @@
<span asp-validation-for="StoreInformationSettings.AllowCustomerToSelectTheme"></span>
</div>
</div>
-<div class="form-group">
- <div class="col-8 col-md-4 col-sm-4 text-right">
- <admin-label asp-for="StoreInformationSettings.AllowToSelectAdminTheme" class="control-label"/>
- </div>
- <div class="col-4 col-md-8 col-sm-8">
- <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
- <admin-input asp-for="StoreInformationSettings.AllowToSelectAdminTheme"/>
- <div class="control__indicator"></div>
- </label>
- <span asp-validation-for="StoreInformationSettings.AllowToSelectAdminTheme"></span>
- </div>
-</div>
<div class="form-group">
<div class="col-8 col-md-4 col-sm-4 text-right">
<admin-label asp-for="StoreInformationSettings.LogoPictureId" class="control-label"/>
diff --git a/src/Web/Grand.Web.Store/Controllers/SettingController.cs b/src/Web/Grand.Web.Store/Controllers/SettingController.cs
index aa716bb02..7afed8599 100644
--- a/src/Web/Grand.Web.Store/Controllers/SettingController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/SettingController.cs
@@ -128,7 +128,15 @@ public class SettingController(
var storeScope = GetStoreScope();
var storeInformationSettings = await settingService.LoadSetting<StoreInformationSettings>(storeScope);
+
+ // Preserve the admin theme selection - store owners cannot change it
+ var allowToSelectAdminTheme = storeInformationSettings.AllowToSelectAdminTheme;
+
storeInformationSettings = model.StoreInformationSettings.ToEntity(storeInformationSettings);
+
+ // Restore the preserved admin theme selection
+ storeInformationSettings.AllowToSelectAdminTheme = allowToSelectAdminTheme;
+
await settingService.SaveSetting(storeInformationSettings, storeScope);
var dateTimeSettings = await settingService.LoadSetting<DateTimeSettings>(storeScope);