I am using Magento 1.9.x.
I have created several custom attributes in Magento project. They all have thousands of labels or options. I don't want to remove custom attribute just want to delete all their values only.
For example I have one attribute as Manufacturer and 1200 options for that attribute now I want to delete all values of Manufacturer Attribute.
How can I do this using SQL queries?
I am following below process
- Get attribute_id from Table: eav_attribute by searching attribute_code (In my case it is "manufacturer" and attribute_id is 81)
- In table eav_attribute_option, searching 81 under attribute_id field will get us all option_ids
- By taking all id's in eav_attribute_option_value, I am searching under option_id and getting value field and removing.
Final Query would be like:
DELETE eav_attribute_option , eav_attribute_option_value FROM eav_attribute_option INNER JOIN eav_attribute_option_value
WHERE eav_attribute_option.option_id= eav_attribute_option_value.option_id and eav_attribute_option.attribute_id = 81
To perform such action for multiple Custom Attributes I need to run this query for multiple time.
Any specific solution??