Plugin question.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anni tempo fa
is there a way to :

1 - have a plugin add an item in the menu in the admin area, and a link or page in public store side
2 - have a plugin override the behavior of en existing module or service.

thank you.
12 anni tempo fa
sch09 wrote:
1 - have a plugin add an item in the menu in the admin area

Ensure that your plugin implements IAdminMenuPlugin interface

sch09 wrote:
1 - have a plugin add a link or page in public store side

If you mean adding some link to info block or header menu, then the answer is no.

sch09 wrote:
2 - have a plugin override the behavior of en existing module or service

Create a class which implements IDependencyRegistrar and override any registered service. For example,
builder.RegisterType<MyCustomCategoryService>().As<ICategoryService>().InstancePerHttpRequest();

Ensure that the value of Order property of this class is bigger than 0 (so it's executed later than the default one (\Presentation\Nop.Web.Framework\DependencyRegistrar.cs)
12 anni tempo fa
a.m. wrote:

1 - have a plugin add a link or page in public store side
If you mean adding some link to info block or header menu, then the answer is no.



Thank you andrei. would it work to create a separate project (area) like Nop.admin that will be added to the public store and add links to the header menu ?
12 anni tempo fa
Header menu. I almost forgot that you can achieve it by using widgets. Have a look at the \Views\Common\Menu.cshtml file (Nop.Web project).. It has the following line of code:
@Html.Action("WidgetsByZone", "Widget", new { widgetZone = Nop.Core.Domain.Cms.WidgetZone.HeaderMenu })

So you can create a new widget with "HeaderMenu" zone supported which will "modify" header menu as you need.



Regarding the info block. Currently there's no way to add new links to it using plugins. The only way to do is to edit the \Views\Common\InfoBlock.cshtml file (Nop.Web project)
12 anni tempo fa
Andrei, in question number 2 above, does overriding a service replace the whole service or we can override just a function in the services ?
12 anni tempo fa
It overrides the entire service. But you can always inherit your custom services from the existing one and simply override a required method.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.