What is PublicWidgetZones

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 yıl önce
I am trying to customize my theme to  NopCommerce 4.10


I couldn't understand what does it mean "PublicWidgetZones"

For example there is in \Presentation\Nop.Web\Views\Home\Index.cshtml
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.HomePageBeforeProducts })
@await Component.InvokeAsync("HomepageProducts")
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.HomePageBeforeBestSellers })
@await Component.InvokeAsync("HomepageBestSellers")


What is the meaning of PublicWidgetZones.HomePageBeforeProducts, where can I  customize it, is it dynamic area that can be edit from Admin panel?
5 yıl önce
Widgets are a type of Plugin that allows you to place custom html (and JavaScript, etc) in widget zones.  There are built in public zones that have been placed in various places in the views (public facing pages).  For example, HomePageBeforeProducts means "on the Home Page, before the list of products").  Widgets built by developers can 'subscribe' to these zones.  But, you don't need to be a developer; there are plugins in the marketplace that allow you to put html/content in the widget zones - e.g. https://www.nopcommerce.com/p/1385/all-in-one.aspx

(It's also possible to create your own custom zones and place them anywhere you want, since the zone identifier is just a text string)
5 yıl önce
Widgets need to be placed at "Zones", i.e Widget Zones.

As an analogy, widget is your cup, widget zone is your table. You place widgets in widget zones, just like you place cups on tables.


5 yıl önce
I am also testing 4.1 with a custom theme. After moving _Root.Head.cshtml to the new themes shared folder I am getting this error and cannot move forward:

@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.HeadHtmlTag })

PublicWidegetZones Does not exist in the current context

Never had this issue before in earlier versions moving _Root.Head.cshtml to a new themes shared folder. Any Idea as to why?

I have rebuilt the solution. Same error.

Same error when moving _root.cshtml to the new themes shared folder.

TIA
5 yıl önce
To solve the issue I had to add:
@using Nop.Web.Framework.Infrastructure

to the pages referenced in previous post:
Is this a bug? Shouldn't these pages already reference that to create new themes?

Moving forward I am having to add the reference to every page moved that has "PublicWidgetZones" referenced.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.