1

Please tell me about using Ui Conditions component in my custom module. I`m trying to make module with products conditions filtration, like a catalog widget 'catalog product list':

conditions filtration

I'm trying to implement conditions component in XML like this:

<fieldset name="conditions">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Conditions</item>
            <item name="collapsible" xsi:type="boolean">true</item>
            <item name="sortOrder" xsi:type="number">20</item>
        </item>
    </argument>
    <container name="conditions_apply_to" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sortOrder" xsi:type="number">10</item>
            </item>
        </argument>
        <htmlContent name="html_content">
            <argument name="block" xsi:type="object">Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Conditions</argument>
        </htmlContent>
    </container>
</fieldset>

And then I have this view in admin console:

enter image description here

But it have wrong menu when i trying to add new condition. I have:

enter image description here

I need to (like a catalog product list widget):

enter image description here

Questions:

  1. The right way to implement and use conditions component;
  2. How to take right menu when I add new condition;
  3. How to take a view of the conditions component like catalog product list widget, instead view which I have.

Thanks beforehand!


For the first and third questions, I found the answer here:

Magento Add Condition Rule In A Custom Form in magento 2

But cannot understand, how to take right menu, with product attributes instead cart attributes. Please help anyone!

1 Answer 1

0

For the second question.

Full example: here

In this example you need replace follow lines in file app/code/Vendor/Rules/Model/Rule.php

find this:

\Magento\SalesRule\Model\Rule\Condition\CombineFactory $condCombineFactory,
\Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF,

Replasce with:

\Magento\CatalogWidget\Model\Rule\Condition\CombineFactory $condCombineFactory,
\Magento\CatalogWidget\Model\Rule\Condition\ProductFactory $condProdCombineF,

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.