1

I have looked over a few times and cant see any tags that are not closed so im lost on whats wrong. I am new to XML and would love the help.

<?xml version="1.0" ?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:ZaniboniCustom:Magento_Widget:etc/widget.xsd">
    <widget class="ZaniboniCustom\productWidget\Block\Widget\ProductGrid" id="ZaniboniCustom_productWidget">
    <label>Product Widget</label>
    <description>Show Products</description>
        <parameters>
            <parameter name="title" xsi:type="text" required="false" visible="true">
                <label translate="true">Title</label>
            </parameter>
            <parameter name="products_sort_by" xsi:type="select" visible="true" source_model="ZaniboniCustom\productWidget\Model\SortBy">
                <label translate="true">Sort Products By</label>
            </parameter>
            <parameter name="products_sort_order" xsi:type="select" visible="true" source_model="ZaniboniCustom\productWidget\Model\SortOrder">
                <label translate="true">Sort Products Order</label>
            </parameter>
            <parameter name="show_pager" xsi:type="select" visible="true" source_model="Magento\Config\Model\Config\Source\Yesno">
                <label translate="true">Display Page Control</label>
            </parameter>
            <parameter name="products_per_page" xsi:type="text" required="true" visible="true" source_model="Magento\Config\Model\Config\Source\Yesno">
                <label translate="true">Number of Products per Page</label>
                <depends>
                    <parameter name="show_pager" value="1" />
                </depends>
                <value>5</value>
            </parameter>
            <parameter name="products_count" xsi:type="text" required="true" visible="true">
                <label translate="true">Number of Products to Display</label>
                <value>10</value>
            </parameter>
            <parameter name="template" xsi:type="select" required="true" visible="true">
                <label translate="true">Template</label>
                <options>
                    <option name="default" value="Magento_catalogWidget::product/widget/content/grid.phtml" selected="true">
                        <label translate="true">Products Grid Template</label>
                    </option>
                </options>
            </parameter>
        </parameters>
    </widget>
</widgets>
1

there is an issue with the xsi:noNamespaceSchemaLocation

use this below XML

<?xml version="1.0" ?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget class="ZaniboniCustom\productWidget\Block\Widget\ProductGrid" id="ZaniboniCustom_productWidget">
        <label>Product Widget</label>
        <description>Show Products</description>
        <parameters>
            <parameter name="title" xsi:type="text" required="false" visible="true">
                <label translate="true">Title</label>
            </parameter>
            <parameter name="products_sort_by" xsi:type="select" visible="true"
                       source_model="ZaniboniCustom\productWidget\Model\SortBy">
                <label translate="true">Sort Products By</label>
            </parameter>
            <parameter name="products_sort_order" xsi:type="select" visible="true"
                       source_model="ZaniboniCustom\productWidget\Model\SortOrder">
                <label translate="true">Sort Products Order</label>
            </parameter>
            <parameter name="show_pager" xsi:type="select" visible="true"
                       source_model="Magento\Config\Model\Config\Source\Yesno">
                <label translate="true">Display Page Control</label>
            </parameter>
            <parameter name="products_per_page" xsi:type="text" required="true" visible="true"
                       source_model="Magento\Config\Model\Config\Source\Yesno">
                <label translate="true">Number of Products per Page</label>
                <depends>
                    <parameter name="show_pager" value="1"/>
                </depends>
                <value>5</value>
            </parameter>
            <parameter name="products_count" xsi:type="text" required="true" visible="true">
                <label translate="true">Number of Products to Display</label>
                <value>10</value>
            </parameter>
            <parameter name="template" xsi:type="select" required="true" visible="true">
                <label translate="true">Template</label>
                <options>
                    <option name="default" value="Magento_catalogWidget::product/widget/content/grid.phtml"
                            selected="true">
                        <label translate="true">Products Grid Template</label>
                    </option>
                </options>
            </parameter>
        </parameters>
    </widget>
</widgets>
2
  • that works and got rid of the error but now I have a new issue where the options dont actually display on the widget menu... the label and description shows but now the parameters – Carter Dec 11 '20 at 19:50
  • refer magento's catalog module widget.xml that may help you to design your own widget or else post new question with all code. – sandip Dec 12 '20 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.