I ran into an issue when I was attempting to update every row within a collection I had previously loaded. The only method I could easily see to do this directly on the collection was via a foreach loop with a save after each setData/addData.

There are other methods throughout Magento to update individual product attributes and other data, but if you’re wanting to call a simple update function on a collection you can implement the following function into your collection resource model.

This function allows you to easily call massUpdate(array()), which in turn updates all the current loaded rows with the specified data.

For instance:

This will only work on flat tables and not any form of data which is stored within EAV.

Dave Macaulay
Dave Macaulay
I'm an enthusiastic, slightly eccentric Magento developer who bores with the idea of another basic brief.