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.

Add a new field to the category - External identifier

KrzysztofPajak3383996bd65f
diff --git a/src/API/Grand.Api/DTOs/Catalog/CategoryDTO.cs b/src/API/Grand.Api/DTOs/Catalog/CategoryDTO.cs
index b764fa692..5a26441b4 100644
--- a/src/API/Grand.Api/DTOs/Catalog/CategoryDTO.cs
+++ b/src/API/Grand.Api/DTOs/Catalog/CategoryDTO.cs
@@ -22,6 +22,7 @@ namespace Grand.Api.DTOs.Catalog
public bool IncludeInMenu { get; set; }
public bool Published { get; set; }
public int DisplayOrder { get; set; }
+ public string ExternalId { get; set; }
public string Flag { get; set; }
public string FlagStyle { get; set; }
public string Icon { get; set; }
diff --git a/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs b/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs
index 046fbff39..4e7e7c196 100644
--- a/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs
+++ b/src/Business/Grand.Business.System/Services/ExportImport/ExportManager.cs
@@ -132,6 +132,7 @@ namespace Grand.Business.System.Services.ExportImport
new PropertyByName<Category>("ShowOnHomePage", p => p.ShowOnHomePage),
new PropertyByName<Category>("IncludeInMenu", p => p.IncludeInMenu),
new PropertyByName<Category>("Published", p => p.Published),
+ new PropertyByName<Category>("ExternalId", p => p.ExternalId),
new PropertyByName<Category>("Flag", p => p.Flag),
new PropertyByName<Category>("FlagStyle", p => p.FlagStyle),
new PropertyByName<Category>("Icon", p => p.Icon),
diff --git a/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs b/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs
index bc9a39ec4..17197fd29 100644
--- a/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs
+++ b/src/Business/Grand.Business.System/Services/ExportImport/ImportManager.cs
@@ -634,6 +634,9 @@ namespace Grand.Business.System.Services.ExportImport
case "searchboxdisplayorder":
category.SearchBoxDisplayOrder = property.IntValue;
break;
+ case "externalid":
+ category.ExternalId = property.StringValue;
+ break;
case "flag":
category.Flag = property.StringValue;
break;
diff --git a/src/Core/Grand.Domain/Catalog/Category.cs b/src/Core/Grand.Domain/Catalog/Category.cs
index df9aa4f06..1a0a560df 100644
--- a/src/Core/Grand.Domain/Catalog/Category.cs
+++ b/src/Core/Grand.Domain/Catalog/Category.cs
@@ -133,6 +133,11 @@ namespace Grand.Domain.Catalog
/// </summary>
public int DisplayOrder { get; set; }
+ /// <summary>
+ /// Gets or sets the ExternalId
+ /// </summary>
+ public string ExternalId { get; set; }
+
/// <summary>
/// Gets or sets the flag
/// </summary>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/_CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/_CreateOrUpdate.TabInfo.cshtml
index 338b47a6b..c2b3f1959 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/_CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/_CreateOrUpdate.TabInfo.cshtml
@@ -254,6 +254,13 @@
<span asp-validation-for="HideOnCatalog"></span>
</div>
</div>
+ <div class="form-group">
+ <admin-label asp-for="ExternalId" />
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="ExternalId" />
+ <span asp-validation-for="ExternalId"></span>
+ </div>
+ </div>
</div>
</div>
<vc:admin-widget widget-zone="category_details_info_bottom" additional-data="Model" />
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
index 0098cd402..46db2fa98 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
@@ -24,34 +24,29 @@ namespace Grand.Web.Admin.Models.Catalog
}
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.Name")]
-
public string Name { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.Description")]
-
public string Description { get; set; }
- [GrandResourceDisplayName("Admin.Catalog.Categories.Fields.BottomDescription")]
+ [GrandResourceDisplayName("Admin.Catalog.Categories.Fields.BottomDescription")]
public string BottomDescription { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.CategoryLayout")]
public string CategoryLayoutId { get; set; }
+
public IList<SelectListItem> AvailableCategoryLayouts { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.MetaKeywords")]
-
public string MetaKeywords { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.MetaDescription")]
-
public string MetaDescription { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.MetaTitle")]
-
public string MetaTitle { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.SeName")]
-
public string SeName { get; set; }
[UIHint("Category")]
@@ -86,6 +81,9 @@ namespace Grand.Web.Admin.Models.Catalog
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }
+ [GrandResourceDisplayName("Admin.Catalog.Categories.Fields.ExternalId")]
+ public string ExternalId { get; set; }
+
[GrandResourceDisplayName("Admin.Catalog.Categories.Fields.Flag")]
public string Flag { get; set; }
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
index 4d220efdd..7249b0cb2 100644
--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
@@ -2172,6 +2172,9 @@
<Resource Name="Admin.Catalog.Categories.Fields.DisplayOrder">
<Value>Display order</Value>
</Resource>
+ <Resource Name="Admin.Catalog.Categories.Fields.ExternalId">
+ <Value>External identifier</Value>
+ </Resource>
<Resource Name="Admin.Catalog.Categories.Fields.FeaturedProductsOnHomePage">
<Value>Show featured products on home page</Value>
</Resource>