Skip to content

Commit 9960883

Browse files
committed
Minor enhancements
1 parent 91d5427 commit 9960883

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/Presentation/SmartStore.Web.Framework/UI/SiteMap/SiteMapBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public TreeNode<MenuItem> Root
3636
using (Services.Chronometer.Step("Build SiteMap '{0}'".FormatInvariant(this.Name)))
3737
{
3838
var root = Build();
39-
39+
4040
// Menu publisher
4141
MenuPublisher.RegisterMenus(root, this.Name);
4242

src/Presentation/SmartStore.Web/Infrastructure/CatalogSiteMap.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public CatalogSiteMap(
4444

4545
public override string Name
4646
{
47-
get { return SiteMapName; }
47+
get => SiteMapName;
4848
}
4949

5050
public override bool ApplyPermissions
@@ -172,23 +172,28 @@ private TreeNode<MenuItem> ConvertNode(TreeNode<ICategoryNode> node, IDictionary
172172

173173
public class CatalogSiteMapInvalidationConsumer : IConsumer<CategoryTreeChangedEvent>
174174
{
175-
private readonly ISiteMap _siteMap;
175+
private readonly Lazy<ISiteMapService> _siteMapService;
176176
private readonly ICommonServices _services;
177177
private readonly CatalogSettings _catalogSettings;
178178

179179
private bool _invalidated;
180180
private bool _countsResetted = false;
181181

182182
public CatalogSiteMapInvalidationConsumer(
183-
ISiteMapService siteMapService,
183+
Lazy<ISiteMapService> siteMapService,
184184
ICommonServices services,
185185
CatalogSettings catalogSettings)
186186
{
187-
_siteMap = siteMapService.GetSiteMap("catalog");
187+
_siteMapService = siteMapService;
188188
_services = services;
189189
_catalogSettings = catalogSettings;
190190
}
191191

192+
private ISiteMap GetSiteMap()
193+
{
194+
return _siteMapService.Value.GetSiteMap("catalog");
195+
}
196+
192197
public void HandleEvent(CategoryTreeChangedEvent eventMessage)
193198
{
194199
var reason = eventMessage.Reason;
@@ -207,7 +212,7 @@ private void Invalidate(bool condition = true)
207212
{
208213
if (condition && !_invalidated)
209214
{
210-
_siteMap.ClearCache();
215+
GetSiteMap().ClearCache();
211216
_invalidated = true;
212217
}
213218
}
@@ -216,7 +221,7 @@ private void ResetElementCounts()
216221
{
217222
if (!_countsResetted && _catalogSettings.ShowCategoryProductNumber)
218223
{
219-
var allCachedTrees = _siteMap.GetAllCachedTrees();
224+
var allCachedTrees = GetSiteMap().GetAllCachedTrees();
220225
foreach (var kvp in allCachedTrees)
221226
{
222227
bool dirty = false;

src/Presentation/SmartStore.Web/Views/Catalog/Partials/OffCanvasMenuCategories.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@model NavigationModel
2+
23
@using SmartStore.Web.Models.Catalog;
34
@using SmartStore.Collections;
45
@using SmartStore.Web.Framework.UI;

0 commit comments

Comments
 (0)