Inserting Widget into sidebar in Magento2.
Widget is a broad term that can refer to either any GUI (graphical user interface) element or a tiny application that can display information and/or interact with the user. A widget can be as rudimentary as a button, scroll bar, label, dialog box or check box; or it can be something slightly more sophisticated like a search box, tiny map, clock, visitor counter or unit converter.
Now to insert a widget into Magento2 sidebar you need to submissive the following steps:
- Configure a widget.
- Configure a Layout update.
While configuring a widget you will also need to Select the Type, Complete the Layout Updates, and Place the Block.
Configure a widget
Owing to the fact that Widget is a predefined set of configuration options, it can be accessed in CMS Page of Magento2 Configuration.
To select the type :
Login to your Store Dashboard click on Content » Widgets.
Look at the upper right corner of Widget you will find Add New Widget button,simply click on it.
- Then Click the Setting button and type CMS Static Block in the Type filed.
- In Design Theme choose any current theme.
- Tap continue.
In Assign to Store View filed you need to assign blocks for each store view.
If more than one block is placed in one container then Set Order , the top block is set as zero .
Click on Layout Upadate in Layout Update section. Here you can specify the page, layout, category, product type or container to display your new widget.
- From the Widget Option » Select Block ( choose one from the list) .
- Click Save.
- Click on the store front to check the view of the block.
Configure a Layout update.
- From the Admin panel Content » Element » Blocks.
- From the listed blocks select a block you want to choose and modify Identifier.
- From the Admin panel Content » Element » Pages.
- Select the Page where the block will be placed , then click on Edit .
- In Layout Update XML box select the Design Tab and insert the following cord:
- Change the Reference Name and Block ID according to the layout of the page.
- Click Save Button.