For a custom plugin with multiple views, how to specify which view goes where?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi, I am creating a plugin that has a view for admin and one for the public site. There is a new section to the product edit page in admin, and also a view to display on the product detail page on the public site. What I am not understanding is how to specify a location for each? I see I can add multiple zones below, but how to specify which view goes where?
Thanks!

public IList<string> GetWidgetZones()
        {
            return new List<string> { PublicWidgetZones.HomepageTop };
        }

        public string GetWidgetViewComponentName(string widgetZone)
        {
            return "MyWidget";
        }
3 years ago
Look at how it's done in \Plugins\Nop.Plugin.Tax.Avalara\AvalaraTaxProvider.cs
3 years ago
New York wrote:
Look at how it's done in \Plugins\Nop.Plugin.Tax.Avalara\AvalaraTaxProvider.cs


there's a condition for returning view. but if i want a view on top and another on bottom at the same time page load then is this possible?
3 years ago
public IViewComponentResult Invoke(string widgetZone, object additionalData)
{
        if (widgetZone == PublicWidgetZones.ProductDetailsOverviewBottom)
            return View("~/Plugins/Group.Name/Views/Widget1.cshtml");
        else if (widgetZone == PublicWidgetZones.Footer)
            return View("~/Plugins/Group.Name/Views/Widget2.cshtml");
    }
return Content("");
}
3 years ago
Yidna wrote:
public IViewComponentResult Invoke(string widgetZone, object additionalData)
{
        if (widgetZone == PublicWidgetZones.ProductDetailsOverviewBottom)
            return View("~/Plugins/Group.Name/Views/Widget1.cshtml");
        else if (widgetZone == PublicWidgetZones.Footer)
            return View("~/Plugins/Group.Name/Views/Widget2.cshtml");
    }
return Content("");
}

thank's
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.