Blog Page

blog details

12 Sep 2022

Category Products Widget Extension Free with Custom Filters Magento2

USER GUIDE

  1. How to Register Module in Magento 2
  2. Tell Magento Which Extesions to Be Included
  3. Create Over Meta Title Remove Class  

After Registering Tell Magento Which Extesions to Be Included
<?xml version="1.0" ?>
        <!--/*
        * Company Name: Cozmot Inc
        * Website: https://cozmot.com
        * Copyright: MIT Licence(Open to edit)
        */-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Cozmot_CategoryWidget"/>
</config>
Now Module Registered so Try adding Widget XML Structure

<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="catalog_category_list"
            class="Cozmot\CategoryWidget\Block\Category\Widget\CategoryList">
        <label translate="true">New Cozmot Category Listing Widget</label>
        <description translate="true">Category Grid</description>
        <parameters>
            <parameter name="title" sort_order="10" visible="true" xsi:type="text">
                <label>Section Heading</label>
            </parameter>
            <parameter name="filter-selection" xsi:type="select" visible="true">
                <label translate="true">Select Filter(optional)</label>
                <options>
                    <option name="most" value="0" selected="true">
                        <label translate="true">New Arrivals</label>
                    </option>
                    <option name="sale" value="1">
                        <label translate="true">Sale</label>
                    </option>
                    <option name="featured" value="2">
                        <label translate="true">Featured</label>
                    </option>
                </options>
            </parameter>
            <parameter name="page_size" xsi:type="text" required="true" visible="true">
                <label translate="true">Number of Category to display</label>
                <value>5</value>
            </parameter>
            <parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
                       class="Magento\CatalogWidget\Block\Product\Widget\Conditions">
                <label translate="true">Conditions</label>
            </parameter>
            <parameter name="template" xsi:type="select" required="true" visible="true">
                <label>Template</label>
                <options>
                    <option name="grid" value="category/widget/grid.phtml" selected="true">
                        <label translate="true">Category Grid Template</label>
                    </option>
                    <option name="sidebar" value="category/widget/sidebar.phtml">
                        <label translate="true">Category Sidebar Template</label>
                    </option>
                </options>
            </parameter>



            <parameter name="chart_layout" xsi:type="select" visible="true">
                <label translate="true">Show in Slider</label>
                <options>
                    <option name="yes" value="1" selected="true">
                        <label translate="true">Yes</label>
                    </option>
                    <option name="no" value="0">
                        <label translate="true">No</label>
                    </option>
                </options>
            </parameter>


        </parameters>
        <containers>
            <container name="sidebar.main">
                <template name="default" value="sidebar" />
            </container>
            <container name="content">
                <template name="grid" value="grid" />
                <template name="list" value="list" />
            </container>
            <container name="sidebar.additional">
                <template name="default" value="sidebar" />
            </container>
        </containers>
    </widget>
</widgets>
Since we added all essential files so you better download and install Our Module to run featue out of Box