0

I have a category in which for some reason some 32 products from 149 have the wrong attribute. At sometime in the past the attribute 'groesse_bekleidung' had it's option '38-FR40' set as default and must have been added to the set of one of the product types in that category.

It has since been removed, so from the backend this attribute can no longer be removed from those 32 products.

I'd like to remove that attribute from the 32 Products in that category, but I am unsure how to.

enter image description here

enter image description here

1 Answer 1

1

Here is a quick and dirty way to do it.
First identify the id of the option. Just filter the category list by the option 38-FR40 and you should see the option id in the url.
then identify the product ids with that value.

$value = 144; //replace with your own value
$attrCode = 'attr_code_goes_here';//replace with your own attribute code
$ids = Mage::getModel('catalog/product')->addAttributeToFilter($attrCode, $value)->getAllIds();

Then just update the attribute value for the products identified above.

Mage::getSingleton('catalog/product_action')->updateAttributes($ids, array($attrCode=>null), 0);

That's it. Just to be sure, backup your database first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.