0

The widget I'm building shows 4 products on the homepage. These products are required to be configurable (Example: multiple colors), have a custom cache timeout, and easily selectable in the options panel. I think the Catalog Widget options might be perfect for that.

How would I be able to use my own logic + the Catalog Widget options in one widget?

Right now I'm using a custom made ProductChooser but the code for that is outdated. The only part I'm still using is the Vendor\Module\Block\Widget\FeaturedProducts Block.

widget.xml

<widget id="featured_products" class="Vendor\Module\Block\Widget\FeaturedProducts"
            is_email_compatible="false" placeholder_image="Magento_Cms::images/widget_block.png">
        <label>Homepage: Featured products</label>
        <description>Featured products</description>

        <parameters>
            <parameter name="title_suffix" xsi:type="text" visible="true" required="true">
                <label>Titel (suffix)</label>
            </parameter>

            <parameter name="product_ids" visible="true" required="true" xsi:type="block">
                <label>Producten</label>
                <block class="Vendor\Module\Block\Adminhtml\Widget\ProductChooser">
                    <data>
                        <item name="button" xsi:type="array">
                            <item name="open" xsi:type="string">Selecteer producten...</item>
                        </item>
                    </data>
                </block>
            </parameter>
        </parameters>
    </widget>

If you have any suggestions or criticism, I would love to hear it.

1 Answer 1

0

Eventually I fixed the problem by copy & pasting certain methods(functions) from the class I was trying to use into our class. Probably not the best solution but for now the only one we have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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