product-edit Tabstrip and implementation questions

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hi there,

Looking for a bit of help to get over a small hurdle.

I am trying to do a variation of product specifications for displaying highlighted features. I had done this as part of the core in 3.2... but now in 3.4 trying to do this as a plugin.

I setup an Event folder and class and put in the HandleEvent to trap for the TabStripName

...

public void HandleEvent(AdminTabStripCreated eventMessage)
        {
            if (eventMessage.TabStripName == "product-edit")
            {
                WidgetsProductHighlightsController controller = new WidgetsProductHighlightsController(_workContext, _storeContext, _storeService, _settingService, _cacheManager, _highlightAttributeService, _languageService, _localizedEntityService, _localizationService, _customerActivityService, _permissionService, _productService);
                
                string res = controller.LoadProductTab();
    eventMessage.BlocksToRender.Add(new System.Web.Mvc.MvcHtmlString(res));
            }
        }


In my Controller...the loadProductTab function


public string LoadProductTab()
{
        if (ControllerContext == null)
            {
                ControllerContext context = new ControllerContext(System.Web.HttpContext.Current.Request.RequestContext, this);
                ControllerContext = context;
            }
//some stuff to populate a model

  return this.RenderPartialViewToString("~/Plugins/Widgets.ProductHighlights/Views/WidgetsProductHighlights/Test.cshtml", model);
            
}


Then the Test.cshtml file

...
<table class="adminContent">
    <tr>
        <td>
            <script>
                $(document).ready(function () {
                    AddTab('Product Highlights');
                });

                function AddTab(title) {

                    var kTabs = $("#product-edit").data("kendoTabStrip");
                    kTabs.append({ text: title, contentUrl: "@Url.Content("~/Plugins/Admin/ProductHighlights")" });
                }

            </script>
        </td>
    </tr>
</table>


~/Plugins/Admin/ProductHighlights points to the controller which returns the view List() for the highlight attribute grid for a product.

The issue is... once I click on my tab in the strip, it seems to work partially, except that the Selected Tab is always the Product Info tab (1st tab) and if I do any interaction at all, things seem to go off the rails.

Questions:  
1. How do I make sure the selected tab stays selected?
2. Overall above...is this the proper best practice/best way to accomplish what I am doing?

Once I get all this pieced together, I will drop this into the new documentation section.  It would be useful to have plugin documentation for stuff like this - interacting with the product tab, and adding product "things" in admin that would be visible via a widget on the front end.

Thanks
9 years ago
To simplify my question.... within a plugin, on the product edit admin, after adding a new tab, does anyone have a piece of sample code that maintains the selected tab so that the first tab isn't always highlighted?
"How do I make sure the selected tab stay selected after clicking on it?"
Thanks
9 years ago
Hi,
Did you resolve this one? I am also struckling with it since it looks like 'C or assembly' code for a PIC controller. So low-level. Is there nothing smarter to load from a controller a (partial)view?
J.
See also: https://www.nopcommerce.com/boards/t/29527/extending-entities-without-editing-the-nopcommerce-330-core.aspx
9 years ago
Resolved it now with: http://stackoverflow.com/questions/25966622/how-to-handle-admintabstripcreated-event-and-use-content-from-plugin
6 years ago
ChuckR wrote:
To simplify my question.... within a plugin, on the product edit admin, after adding a new tab, does anyone have a piece of sample code that maintains the selected tab so that the first tab isn't always highlighted?
"How do I make sure the selected tab stay selected after clicking on it?"
Thanks


I am Having the same issue with NopCommerce 3.90. Any suggestions for how to fix this.

Quick Response will be highly appreciated.
6 years ago
bash720 wrote:
To simplify my question.... within a plugin, on the product edit admin, after adding a new tab, does anyone have a piece of sample code that maintains the selected tab so that the first tab isn't always highlighted?
"How do I make sure the selected tab stay selected after clicking on it?"
Thanks

I am Having the same issue with NopCommerce 3.90. Any suggestions for how to fix this.

Quick Response will be highly appreciated.


This old threat relates to Nop versions prior to 3.8 when the tab strip was done via kendoTabStrip.  The tab strip now in the admin is done via bootstrap not kendo.

You should be looking at other topics related to 3.8 or newer. Like this one.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.