1

The slow way that works:

Mage::getModel('catalog/product')
            ->load($productId)
            ->setStoreId($storeId)
            ->setData($code , null)
            ->save();

I've seen:

Mage::getModel('catalog/product')
            ->addAttributeUpdate($code, null , $storeId);

This however deletes the default value as well. (possible bug ?)

Other examples I have seen are raw mysql delete queries.

I though that this would be something native to Magento.

Any thoughts on this?

1 Answer 1

2

Try it like this:

Mage::getSingleton('catalog/product_action')->updateAttributes(
    array($productId),  //array with product ids - works with multiple ids at the same time
    array($code=>null), //attributes to update - can update multiple attributes in one call 
    $storeId, //store to update. 0 = default values.
);
1
  • This works for updating a store value to a value, but not for setting it to use default Commented Jul 7, 2014 at 7:14

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.