Skip to content

Commit

Permalink
Add new field ExternalId to the brand entity
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Oct 14, 2021
1 parent 6a7a00e commit 766bbf5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/API/Grand.Api/DTOs/Catalog/BrandDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class BrandDto : BaseApiEntityModel
public bool IncludeInMenu { get; set; }
public string Icon { get; set; }
public bool Published { get; set; }
public string ExternalId { get; set; }
public int DisplayOrder { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public virtual byte[] ExportBrandsToXlsx(IEnumerable<Brand> brands)
new PropertyByName<Brand>("AllowCustomersToSelectPageSize", p => p.AllowCustomersToSelectPageSize),
new PropertyByName<Brand>("PageSizeOptions", p => p.PageSizeOptions),
new PropertyByName<Brand>("Published", p => p.Published),
new PropertyByName<Brand>("DisplayOrder", p => p.DisplayOrder)
new PropertyByName<Brand>("DisplayOrder", p => p.DisplayOrder),
new PropertyByName<Brand>("ExternalId", p => p.ExternalId)
};

return ExportToXlsx(properties, brands);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,9 @@ protected virtual void PrepareBrandMapping(Brand brand, PropertyManager<Brand> m
case "displayorder":
brand.DisplayOrder = property.IntValue;
break;
case "externalid":
brand.ExternalId = property.StringValue;
break;
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Grand.Domain/Catalog/Brand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public Brand()
public bool LimitedToStores { get; set; }
public IList<string> Stores { get; set; }

/// <summary>
/// Gets or sets the ExternalId
/// </summary>
public string ExternalId { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the entity is published
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@
<span asp-validation-for="DisplayOrder"></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="brand_details_info_bottom" additional-data="Model" />
8 changes: 4 additions & 4 deletions src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@ public BrandModel()
}

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.Name")]

public string Name { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.Description")]

public string Description { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.BottomDescription")]

public string BottomDescription { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.BrandLayout")]
public string BrandLayoutId { get; set; }
public IList<SelectListItem> AvailableBrandLayouts { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.MetaKeywords")]

public string MetaKeywords { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.MetaDescription")]
Expand Down Expand Up @@ -84,6 +80,9 @@ public BrandModel()
[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.ExternalId")]
public string ExternalId { get; set; }

public IList<BrandLocalizedModel> Locales { get; set; }

//ACL
Expand Down Expand Up @@ -143,5 +142,6 @@ public partial class BrandLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
[GrandResourceDisplayName("Admin.Catalog.Brands.Fields.SeName")]

public string SeName { get; set; }

}
}
3 changes: 3 additions & 0 deletions src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,9 @@
<Resource Name="Admin.Catalog.Brands.Fields.DisplayOrder">
<Value>Display order</Value>
</Resource>
<Resource Name="Admin.Catalog.Brands.Fields.ExternalId">
<Value>External identifier</Value>
</Resource>
<Resource Name="Admin.Catalog.Brands.Fields.Icon">
<Value>Icon</Value>
</Resource>
Expand Down

0 comments on commit 766bbf5

Please sign in to comment.