Remove Values From Attribute
Today I had to change the values of a magento product attribute.
I had an attribute
color with the values:
- ... (all other CSS2.1 color names)
And I had to change it to german values.
So I had a look into
$installer->addAttribute() the method checks wether the attribute exists or not and calles
Great, let's just update the Attribute
I updated the attribute, the result was:
- braun (german: brown)
- blau (german: blue)
That is wrong.
Just remove the wrong values
I didn't find a way to remove the values from an attribute. If you have one, tell me!
The easiest and nicest way I found was:
$installer->removeAttribute(Mage_Catalog_Model_Product::ENTITY, 'color'); // [...] $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'color', $data);
Remove the attribute and create it with the new values.
Bad thing about it? All values will be deleted for all products!