Using this code

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

        $configChooser = [
            'button' => [
                'open' => __('Select Products'),
                'type' => '\Magento\Catalog\Block\Adminhtml\Product\Widget\Chooser',

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. May 7, 2018 at 10:06

2 Answers 2

 <fieldset name="assign_products" sortOrder="40">
            <label translate="true">Products</label>
                <container name="assign_products_container" sortOrder="160">
                 <htmlContent name="html_content">
                     <block name="my_assigned_products" class="Magento\Catalog\Block\Adminhtml\Product\Grid">
                            <argument name="button" xsi:type="array">
                             <item name="open" xsi:type="string" translate="true">Select Product...</item>
  • perfact work on my custom ui form thanks a lot.
    – user77175
    Feb 19, 2019 at 13:29
  • I got main.CRITICAL: Invalid method Magento\Catalog\Block\Adminhtml\Product\Grid::prepareElementHtml
    – Bafi
    Jun 6, 2021 at 18:05
<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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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