Magento2: Multi-select for Product edit not saving values other than first selection on Save

Created on 2 Jun 2016  路  34Comments  路  Source: magento/magento2

I am experiencing an issue similar to issue #4346. If I try to select multiple items for a multi select attribute from the product edit view (in this case, the attribute is Bolt Pattern), only the first one is actually saved to database when I press Save.
screen shot 2016-06-01 at 4 02 32 pm
However, if I go to the database and manually add the value for the attribute in the catalog_product_entity_varchar table, it shows up correctly when I reload the page in admin panel

screen shot 2016-06-01 at 4 09 52 pm
screen shot 2016-06-01 at 4 11 17 pm

but if I press Save, again it only selects the first one and all the others are removed from database as well.

screen shot 2016-06-01 at 4 12 49 pm
screen shot 2016-06-01 at 4 13 27 pm

Catalog Cannot Reproduce Format is not valid needs update bug report

Most helpful comment

Fixed, go to eav_attribute table, search you multiselect attribute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex and ty.

All 34 comments

have you created attribute using script or backed?

It was migrated from Magento 1. I have not checked if this problem exists with new attributes created in Magento 2.

may be it problem with migration Plase check source model and backend model for same.

Fixed, go to eav_attribute table, search you multiselect attribute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex and ty.

I'm seeing this problem too, albeit with Customer.. Created using a script properly. Can include source if requested. I'm using the Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend method. No values are persisting for me, but the attribute is saving the option_id to the database in the customer_entity_ table. I've tried text and varchar. Both save but will not populate the dropdown.

@simon-zhu
Please, provide the used version. If the problem is actual for a specific tag, please, specify it and be sure that the latest update was used.

Hi Simon, used version is: Magento 2.0.7, PHP 5.6 and now multiselect works fine. This issue is coming afther migrate customers, order, etc from Magento 1.9 to Magento 2.

I was having the same problem. Migrated a site from 1.9.x to 2 and multiselect attributes have null for backend_model. saving the attributes would not change the values.

SQL to change would be:
UPDATEeav_attributeSETbackend_model= 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend' WHEREattribute_code= 鈥榶our_attribute_code';

Replace "your_attribute_code" with the attribute code of the attribute that is giving you trouble.

Magento 2.1.3 still reproducible. Multi-select attribute not being saved. Although
backend_type = varchar
backend_model = Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend

Fixed For me magento2.1.0, go to eav_attibute table, search you multiselect attibute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex and ty.

@AbdulKadir-Agoliya I tried that, but didn't help. The only workaround I found is to use the Mass action attributes update. Then it saves the change of multi-select attribute

2.1.4 and the problem still exist

I have this issue on not saving multiselect in a product.
I see this issue reported here. It could be various reasons but also it can be the same issue:
https://github.com/magento/magento2/issues/7646
https://github.com/magento/magento2/issues/5445

This happens to me if I have 1 configurable product from other attribute set that does not have this attribute in it.
Actually I'm doing more tests and I see that only if I have 1 configurable product (and doesn't matter if i have the multiselect in the second attribute set or not) in related products it will not save the attribute.
It happens only for multiselect. I've tested with dropdown and boolean and the issue is not there. I've tested it on CE 2.1.6 with sample data too.
Are you in the same case ? Do you have a configurable product in related, cross or up-sell products like my case ?

Hello, @simon-zhu. We were not able to reproduce Your on neither of develop versions for Magento2. (2.0.15, 2.1.7, 2.2.0). Please if You still can reproduce this issue on either of versions let us know. Thanks for Your reporting.

Hello Magento Team,
I had similar problem, but only sometime. After some investigation I found:

  1. Can not save multiselect attributes if there is related product attached.
  2. If I have any product attached to related, when I try to change options in multiselect attributes, I was not able to save with the new selection set.
  3. On the same products when I remove the product attached to related, everything worked as expected.
    So if I have any product with multiselect which needs change, I had to remove related products, make changes to multiselect options and save. After saving all atributes are saved correctly and then add the related products and save again.
    Tested on Magento 2.2

Tested on 2.1.9

I'm having the same issue. Even when creating a new product attribute of type multiselect in the backend, the problem occurs: when selecting an option in the multiselect on a product, the value doesn't get saved.

As @AgentGod explained, there's a detour of making this to work:

  1. remove all upsells, cross-sells and related products.
  2. save the product
  3. make changes to the multiselect attribute on the product
  4. save the product
  5. add all the upsells, ...

@duckchip
Fixed For me magento2.1.0, go to eav_attibute table, search you multiselect attibute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex .

hello @duckchip
Fixed For me magento2.1.0, go to eav_attibute table, search you multiselect attibute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex .

Hi @AbdulKadir-Agoliya
I'm running on 2.1.9 and this fix is already included, unfortunately it's still not working.
I think it has to do with a problem relating to configurable products as cross-sells/up-sells/....

Still having the problem on 2.1.11

Update: This was fixed by...

https://github.com/magento/magento2/issues/4822#issuecomment-253877404

I have this exact issue on Magento 2.2.5

I Found Solution after R&D On Magento database.
Login In your phpmyadmin
Go to your website database
Open "eav_attribute" table
Find Your multiselect "attribute_id"
Edit Row
If "backend_model" Column blank then paste this
Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend
And Please check this Url
https://magento.stackexchange.com/questions/224621/warning-array-filter-expects-parameter-1-to-be-array/230444#230444

same issue, magento 2.2.4

hello #mariamghalleb
Fixed For me magento2.1.0, go to eav_attibute table, search you multiselect attibute and change in "backend_model" column NULL value with this value: Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend, clear cache and reindex .

I had to change backend_type from varchar to text to get it to work.

@AbdulKadir-Agoliya that column is not NULL by default it has Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend.

getData($key) and getData()[$key] return different values, scalar vs array

My fix
screenshot from 2018-07-20 17-33-40

@AbdulKadir-Agoliya that column is not NULL by default it has Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend.

Same here. I still have to delete my related products in order to make it work

I still have the problem in 2.1.9 and this is beginneng to get frustrated.

I had to change backend_type from varchar to text to get it to work.

This works only then the dropdown in the frond-end goes away.

The solutions of changing the "backend_model" does not work for me, but is there someone who can help me with a solution

Magento 2.1.3 still reproducible. Multi-select attribute not being saved. Although
backend_type = varchar
backend_model = Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend

Dit you find a solution? Because i'm in 2.1.15 and i've tried all these methods and nothing works

same issue.

Magento 2.2.6 Multi-select attribute not being saved. Although
backend_type = varchar
backend_model = Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend

I also don't have any related products but still facing an issue

After long hind and seek with database, I came to know that it was the migration issue from m1 to Magento 2.

The following list of items has fixed the issue for me.

backend_type = text
backend_model = Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend

php bin/magento c:c

php bin/magento c:f

Hope this will fix it out for you.

After long hind and seek with database, I came to know that it was the migration issue from m1 to Magento 2.

The following list of items has fixed the issue for me.

backend_type = text
backend_model = Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend

php bin/magento c:c

php bin/magento c:f

Hope this will fix it out for you.

You also need to reindex

Was this page helpful?
0 / 5 - 0 ratings