14

Using this code

$chooser = $this->_layout->createBlock('\Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser');
        var_dump(get_class_methods($chooser));

        $configChooser = [
            'button' => [
                'open' => __('Select Products'),
                'type' => '\Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser',
            ]
        ];
        $chooser->setConfig($configChooser)
            ->setFieldsetId($fieldsetData->getId())
        ->prepareElementHtml($productChooser);

I can get a pretty nice product selector for my custom field in my custom form, but i need it to be able to select several product. There is a chooser config that i can be able to set?

  • 2
    Hi Gianni, can you share more code for Product Chooser in custom module form, please. I want to figured out that but I couldn't. Thanks. – hayatbiralem May 7 '18 at 10:06
1
 <fieldset name="assign_products" sortOrder="40">
            <settings>
                <collapsible>true</collapsible>
            <label translate="true">Products</label>
            </settings>
                <container name="assign_products_container" sortOrder="160">
                 <htmlContent name="html_content">
                     <block name="my_assigned_products" class="Magento\Catalog\Block\Adminhtml\Product\Grid">
                     <arguments>
                            <argument name="button" xsi:type="array">
                             <item name="open" xsi:type="string" translate="true">Select Product...</item>
                            </argument>
                     </arguments>
                     </block>
            </htmlContent>
            </container>
</fieldset>
  • perfact work on my custom ui form thanks a lot. – user77175 Feb 19 at 13:29
0
<fieldset name="assign_products" sortOrder="40">

true Products Select Product...


use Magento\Catalog\Block\Adminhtml\Product\Grid instead of Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser

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.