Skip to content

Commit

Permalink
VP-1268: Make category properties available using "." (#373)
Browse files Browse the repository at this point in the history
* Make category properties available in liquid handlers.
Change type of category.properties from IList to IMutablePageList
  • Loading branch information
AliveMen authored and yecli committed Jan 23, 2020
1 parent 877a5d5 commit 6188ecb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 3 additions & 6 deletions VirtoCommerce.Storefront.Model/Catalog/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

namespace VirtoCommerce.Storefront.Model.Catalog
{
public partial class Category : Entity, IHasProperties, IAccessibleByIndexKey
public partial class Category : Entity, IAccessibleByIndexKey
{
public Category()
{
Images = new List<Image>();
Properties = new List<CatalogProperty>();
Properties = MutablePagedList<CatalogProperty>.Empty;
}

public string CatalogId { get; set; }
Expand Down Expand Up @@ -71,10 +71,7 @@ public override string ToString()
return SeoPath ?? base.ToString();
}

#region IHasProperties Members
public IList<CatalogProperty> Properties { get; set; }
#endregion

public IMutablePagedList<CatalogProperty> Properties { get; set; }
public string Handle => SeoInfo?.Slug ?? Id;
public string IndexKey => Handle;
}
Expand Down
5 changes: 2 additions & 3 deletions VirtoCommerce.Storefront/Domain/Catalog/CatalogConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,9 @@ public static Category ToCategory(this catalogDto.Category categoryDto, Language

if (categoryDto.Properties != null)
{
result.Properties = categoryDto.Properties
result.Properties = new MutablePagedList<CatalogProperty>(categoryDto.Properties
.Where(x => string.Equals(x.Type, "Category", StringComparison.OrdinalIgnoreCase))
.Select(p => ToProperty(p, currentLanguage))
.ToList();
.Select(p => ToProperty(p, currentLanguage)));
}

return result;
Expand Down

0 comments on commit 6188ecb

Please sign in to comment.