Need to add tab into product edit page admin side in nop 4.20 using plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 4 años
Hi
I am using nop 4.20 and created a plugin which  have to use on product edit page of admin section , So what will will be the process/code to add this plugin widget in product edit page of admin section as a new tab.

here is my code:
public void HandleEvent(AdminTabStripCreated tabEventInfo)
        {
            if (tabEventInfo != null && !string.IsNullOrEmpty(tabEventInfo.TabStripName))
            {
                if (tabEventInfo.TabStripName == "attachment-panels")
                {
                    var urlHelper = new UrlHelper(_actionContextAccessor.ActionContext);

                    object objectId = _actionContextAccessor.ActionContext.RouteData.Values["id"];

                    if (!string.IsNullOrEmpty(objectId.ToString()))
                    {
                        var _localizationService = EngineContext.Current.Resolve<ILocalizationService>();

                        string text = _localizationService.GetResource("Plugin.Product.Multiple.Attachment");
                        string SubFolder = _localizationService.GetResource("Plugin.Product.Multiple.Attachment.SubFolder");
                        string content = urlHelper.RouteUrl("CreateAttachment", new { ProductId = objectId });//SubFolder+"Products/ProductAttachment/Create/" + objectId;//
                        tabEventInfo.BlocksToRender.Add(new Microsoft.AspNetCore.Html.HtmlString(
                        "<script>"
                                + "$(document).ready(function() {"
                                    + "$(\"<li><a data-tab-name='tab-additional-tab' data-toggle='tab' href='#tab-additional-tab'>"
                                    + text + "</a></li> \").appendTo('#attachment-panels .nav-tabs:first');"

                                    + "$.get('" + content + "', function(result) {"
                                    + "$(\"<div class='tab-pane' id='tab-additional-tab'>\" + result + \"</div>\").appendTo('#attachment-panels .tab-content:first');"
                                    + "});"
                                + "});"
                        + "</script>"));
Hace 3 años
Hi @kshVijay,

The implementation is changed for adding additional tab or panel in Any admin page from 4.20. For that you have to create new widget for this additional panel.

nopCommerce already defined AdminWidgetZones. You have to use them and create component in similar way that we do in public area component & yes, don't forget to enable that widget from Widget List.

if you don't know which widget zone is used in that admin page then you can find widget zone by opening same view in any editor or VS.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.