Skip to content

Commit

Permalink
Minor changes - product tags
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Jul 10, 2019
1 parent 7521d1c commit 16deb5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Grand.Web/Services/CatalogViewModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,14 +1185,14 @@ public virtual async Task<PopularProductTagsModel> PreparePopularProductTags()
//get all tags
var allTags = (await _productTagService
.GetAllProductTags())
.OrderByDescending(x => _productTagService.GetProductCount(x.Id, _storeContext.CurrentStore.Id))
.OrderByDescending(x => x.Count)
.ToList();

var tags = allTags
.Take(_catalogSettings.NumberOfProductTags)
.ToList();
//sorting
tags = tags.OrderBy(x => x.GetLocalized(y => y.Name, _workContext.WorkingLanguage.Id)).ToList();
tags = tags.OrderBy(x => x.Name).ToList();

model.TotalTags = allTags.Count;

Expand All @@ -1201,7 +1201,7 @@ public virtual async Task<PopularProductTagsModel> PreparePopularProductTags()
Id = tag.Id,
Name = tag.GetLocalized(y => y.Name, languageId),
SeName = tag.SeName,
ProductCount = _productTagService.GetProductCount(tag.Id, _storeContext.CurrentStore.Id)
ProductCount = tag.Count
});
return model;
});
Expand All @@ -1213,7 +1213,7 @@ public virtual async Task<PopularProductTagsModel> PrepareProductTagsAll()
var model = new PopularProductTagsModel();
model.Tags = (await _productTagService
.GetAllProductTags())
.OrderBy(x => x.GetLocalized(y => y.Name, _workContext.WorkingLanguage.Id))
.OrderBy(x => x.Name)
.Select(x =>
{
var ptModel = new ProductTagModel {
Expand Down

0 comments on commit 16deb5c

Please sign in to comment.