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?

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.
);
  • This works for updating a store value to a value, but not for setting it to use default – Danny Dev Nz Jul 7 '14 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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