All about using widgets with Magento

Magento Widgets are Magento extensions with a predefined set of configuration options through which the store administrators can enrich the front-end blocks functionality. The widgets options can be tuned by the Magento store administrators once installed. Magento Widgets allow business users with no technical knowledge to easily add dynamic content to pages in Magento Stores. Here is all about using widgets with Magento. They provide great control and flexibility in creating marketing and informational content through the Magento administrator panel such as

  • Dynamic product data in Marketing Campaign Landing Pages
  • Dynamic information such as Recently Viewed Items into Content Pages
  • Promotional images to position in side columns, different blocks and other locations throughout the storefront
  • Action blocks and Interactive elements
  • Alternative navigation elements (tag clouds, catalogue image sliders)
  • Create dynamic and interactive flash elements which can be easily configured and embedded within content pages for enhanced user experience.

 How to develop a Magento widget

Developing a widget doesn’t differ much from developing a regular Magento extension which provides some frontend functionality. One can also develop extensions which add placement control and configuration options to the functionality which already exists in other extensions.

Create an empty module:  You have to create a module code folder under an appropriate code pool to start a new Magento module. The folder should contain a default module helper and a module configuration file called config.xml.

  • A node with a name being unique in the system
  • Widget name declaration.
  • Short description of the widget

Define the “enabler” file:  You should also add a small “enabler” file under folder that will enable Magento to know that the new module is available and resides in the specific code pool. You have to define the dependencies and code pool of the module in this file and you can also specify here whether the module is enabled or disabled. Specifying the dependencies guarantees that your module is installed after the modules on which your module depends on.

Create the default module helper: In order to make translation subsystem work properly, the default helper should be defined.

Create the configuration file:  Define the module version in the configuration file. Also, we have to define a helper and blocks base class names as long as we need to create our module in the custom namespace.

Declare widgets:  Widgets provided by the module must be declared in the widget.xml file under the module’s etc/ folder. A minimal declaration of the widget must contain the following:

How to install widgets

  • First, find a widget you want and get its extension key from the Magento Connect site. Click on Install Now and choose the Magento Connect version once you find a widget suitable for your Magento version. Check and agree the license agreement and click the Get Extension Key button, then select and copy it.
  • Open the Magento Admin Area->System->Magento Connect->Magento Connect Manager.  The admin login details should be entered and the extension key should be pasted in the Paste extension key to install field. Proceed by clicking on the extension button
  •  Return to the Magento Admin Area after the installation is completed and navigate to CMS->Pages to insert the widget to your pages.
  • Click on the page where you would like the widget to appear, open the Content section and then click on the Insert Widget icon.
  • A new window will appear. From the drop-down menu pick the Widget Type and then click the Insert Widget button.
  • The widget will be inserted. In the Magento administrator area click on the Save Page button. After this you can check your page on the frontend to confirm the widget is showing properly.