1

We have an attribute for some of our products that has hundreds of empty values. If you try to make and save any changes to any values, it kicks you back out to the dashboard and the changes are not saved. Is there a way to delete all empty values without deleting the entire attribute?

UPDATE

Over a year later and I am still dealing with this issue, I have tried using the query mentioned here: https://magento.stackexchange.com/a/16123/100539, but did not get any results. Does anyone have another query I can try or another method around this?

UPDATE 2

I figured it out, see my answer below.

2 Answers 2

2

Okay, I figured it out. I couldn't find a single SQL command to do everything but this is the process I used to fix this.

  1. go to the eav_attribute table of your database and find the attribute_id of the attribute with the empty values
  2. go to the eav_attribute_option_value table and find the attribute options that you want to keep (I had 28 values I did not want to delete, if you have more, this may take some time). If you have multiple options with the same value, you can click on the option_id and see if it matches to the attribute_id from step 1 (at least in phpmyadmin)
  3. once you have your list of option_ids, you can go to the eav_attribute_option table and search for all options with the attribute_id from step 1 (in my case, I had 5428 options), then you can use this command to find how many blank options you have:

SELECT * FROM eav_attribute_option WHERE attribute_id = [attribute_id from setp 1] AND option_id NOT IN (option_id list)

  1. Verify that this is the data that you want to delete and run the following command:

DELETE FROM eav_attribute_option WHERE attribute_id = [attribute_id from setp 1] AND option_id NOT IN (option_id list)

This deleted the 5400 empty options that I had in my custom attribute. I hope this helps someone else.

0

You need to remove empty values manually or execute sql query in your database.You need to take DB backup.

1

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.