-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMegaMenuPlugin.cs
More file actions
112 lines (95 loc) · 4.29 KB
/
Copy pathMegaMenuPlugin.cs
File metadata and controls
112 lines (95 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using Nop.Core;
using Nop.Core.Domain.Catalog;
using Nop.Core.Events;
using Nop.Core.Plugins;
using Nop.Services.Cms;
using Nop.Services.Configuration;
using Nop.Services.Events;
using Nop.Services.Localization;
using Nop.Services.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Routing;
namespace Nop.Plugin.Widgets.MegaMenu
{
public class MegaMenuPlugin : BasePlugin, IWidgetPlugin
{
private readonly IPictureService _pictureService;
private readonly ISettingService _settingService;
private readonly IWebHelper _webHelper;
public MegaMenuPlugin(IPictureService pictureService,
ISettingService settingService, IWebHelper webHelper)
{
this._pictureService = pictureService;
this._settingService = settingService;
this._webHelper = webHelper;
}
/// <summary>
/// Gets widget zones where this widget should be rendered
/// </summary>
/// <returns>Widget zones</returns>
public IList<string> GetWidgetZones()
{
return new List<string> { "header_menu_before" };
}
/// <summary>
/// Gets a route for provider configuration
/// </summary>
/// <param name="actionName">Action name</param>
/// <param name="controllerName">Controller name</param>
/// <param name="routeValues">Route values</param>
public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
{
actionName = "Configure";
controllerName = "MegaMenu";
routeValues = new RouteValueDictionary { { "Namespaces", "Nop.Plugin.Widgets.MegaMenu.Controllers" }, { "area", null } };
}
public void GetDisplayWidgetRoute(string widgetZone, out string actionName, out string controllerName, out RouteValueDictionary routeValues)
{
actionName = "PublicInfo";
controllerName = "MegaMenu";
routeValues = new RouteValueDictionary
{
{"Namespaces", "Nop.Plugin.Widgets.MegaMenu.Controllers"},
{"area", null},
{"widgetZone", widgetZone}
};
}
public override void Install()
{
var settings = new MegaMenuSettings
{
Product = true,
productIndex = 1,
Category = true,
categoryIndex = 2,
Manufacturer = true,
manufacturerIndex = 3
};
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Product", "Product");
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Product.Hint", "Check all the Products which you want to show in the MegaMenu DropDown in Products");
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Category", "Category.");
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Category.Hint", "Select all the Category which you want to show in the MegaMenu DropDown in Products.");
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Manufacturer", "Manufacturer");
this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.MegaMenu.Manufacturer.Hint", "Manufacturer.");
_settingService.SaveSetting(settings);
base.Install();
}
public override void Uninstall()
{
//settings
_settingService.DeleteSetting<MegaMenuSettings>();
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Product");
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Product.Hint");
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Category");
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Category.Hint");
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Manufacturer");
this.DeletePluginLocaleResource("Plugins.Widgets.MegaMenu.Manufacturer.Hint");
//locales
base.Uninstall();
}
}
}