How to programmatically manipulate product’s attributes for every store view in Magento


Sometimes we need to manipulate with the attributes of our products.

Of course, every web shop has many products so it doesn’t make sense to do it manually. There is also a catch. Magento provides us with a posibility of having multiple stores, so if we edit a product’s attribute in one store view, it will remain the same in all others.

In the following code you can see a function that manipulates with attributes for every product in every store. All you need to do is to copy this function to the Observer.php file of your module and insert small alterations that are specific for your project. Also you need to insert the event that will trigger the changes in the config.xml file.

Hope you find this helpful!