0

I have an attribute product that is a multiple select. I need to fill it with many operation options to select from, like a thousand or more.

Is there the possibility to put this multiple selection in a modal using a grid or some kind of filter so that it only shows me the selected options and use a search bar to display the options that I want to select?

1 Answer 1

1
$multiSelectData = ['option1', 'option2', 'option3', 'option4', 'option5'];

        $data = array(
        'attribute_set'           => 'Default',
        'group'                   => 'Autosettings',
        'type'                    => 'text',
        'backend'                 => '',
        'frontend'                => '',
        'label'                   => 'YOURATTRIBUTELABEL',
        'input'                   => 'text',
        'class'                   => '',
        'source'                  => '',
        'global'                  => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
        'visible'                 => true,
        'required'                => false,
        'user_defined'            => true,
        'default'                 => '',
        'searchable'              => true,
        'filterable'              => true,
        'comparable'              => true,
        'visible_on_front'        => true,
        'used_in_product_listing' => true,
        'unique'                  => false,
        'apply_to'                => '',
        'is_used_in_grid'         => true,
        'is_visible_in_grid'      => true,
        'is_filterable_in_grid'   => true,
    );

if (!$multiSelectData === false && is_array($multiSelectData)) {
        $data['input'] = 'multiselect';
        $data['option'] = array('values' => $multiSelectData);
        $data['backend'] = 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend';
}

NOTE Into this code, $multiSelectData which show as array static, you can create those array from your dynemic grid collection value. So it will show options from your customize grid.

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.