Hello Everone I want to add a new tab in Product Admin panel. But IConsumer Missing
https://prnt.sc/tqsv0h
Doc : https://docs.grandnode.com/how-to-create-admin-tabs
Waiting for your help Thank you
IConsumer Missing
Tuesday, November 26, 2024 1:54:07 AM
Hi,
There are several ways to add new tab on the product.
One of this is:
1. Prepare new plugin as IWidgetPlugin (and set widgetzone = product_details_tabs)
public IList<string> GetWidgetZones()
{
return new List<string> { "product_details_tabs" };
}
public void GetPublicViewComponent(string widgetZone, out string viewComponentName)
{
viewComponentName = "";
if (widgetZone == "product_details_tabs")
{
viewComponentName = "MyProductViewComponent";
}
}
2. Create new class as a component
[ViewComponent(Name = "MyProductViewComponent")]
public class MyProductViewComponent : ViewComponent
{
public MyProductViewComponent()
{
}
public IViewComponentResult Invoke(string widgetZone, object additionalData)
{
if (widgetZone == "product_details_tabs")
{
return View("~/Plugins/Misc.MyPlugin/Views/NewTab.cshtml");
}
return Content("");
}
3. Create new View cshtm file
<tabstrip-item text="My new tab" tab-index="15">
<content>
<div>
Test
</div>
</content>
</tabstrip-item>
After installation of plugin do not forget do active the plugin in /Admin/Widget/List
There are several ways to add new tab on the product.
One of this is:
1. Prepare new plugin as IWidgetPlugin (and set widgetzone = product_details_tabs)
public IList<string> GetWidgetZones()
{
return new List<string> { "product_details_tabs" };
}
public void GetPublicViewComponent(string widgetZone, out string viewComponentName)
{
viewComponentName = "";
if (widgetZone == "product_details_tabs")
{
viewComponentName = "MyProductViewComponent";
}
}
2. Create new class as a component
[ViewComponent(Name = "MyProductViewComponent")]
public class MyProductViewComponent : ViewComponent
{
public MyProductViewComponent()
{
}
public IViewComponentResult Invoke(string widgetZone, object additionalData)
{
if (widgetZone == "product_details_tabs")
{
return View("~/Plugins/Misc.MyPlugin/Views/NewTab.cshtml");
}
return Content("");
}
3. Create new View cshtm file
<tabstrip-item text="My new tab" tab-index="15">
<content>
<div>
Test
</div>
</content>
</tabstrip-item>
After installation of plugin do not forget do active the plugin in /Admin/Widget/List
0
Hello John,
In fact, we don't have a list of admin panel widget zones. We will try to list them, for now, please look at the following commit, my collegue Tom added widget zones in admin panel in it. It will give you a short feedback about available widget zones. I hope it will help you.
Cheers!
In fact, we don't have a list of admin panel widget zones. We will try to list them, for now, please look at the following commit, my collegue Tom added widget zones in admin panel in it. It will give you a short feedback about available widget zones. I hope it will help you.
Cheers!
Best regards,
Patryk
GrandNode Team
Patryk
GrandNode Team
0