title: Setting attributes on store level in Magento
body: <p>I am trying to get Magento to set product attribute values on store views to be the same as the default values.</p>
  
  <p>I have the following code called by an observer on</p>
  
  <pre><code>catalog_product_save_before
  
  public function translateProduct($observer)
  {
      Mage::app()-&gt;setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
      $product = Mage::getModel('catalog/product')-&gt;load($observer-&gt;getEvent()-&gt;getProduct()-&gt;getId());
  
      foreach (Mage::app()-&gt;getWebsites() as $website) {
          foreach ($website-&gt;getGroups() as $group) {
              foreach ($group-&gt;getStores() as $store) {
                  $config = $store-&gt;getConfig('myconfig');
                  if($config['enabled']) {
                      foreach($product-&gt;getAttributes() as $attribute) {
                          if($attribute-&gt;getBackendType() == 'text' &amp;&amp; $attribute-&gt;getFrontend()-&gt;getValue($product) != '') {
                              $product-&gt;setStoreId($store-&gt;getId())-&gt;setData($attribute-&gt;getAttributeCode(), $attribute-&gt;getFrontend()-&gt;getValue($product));
                          }
                      }
                  }                
              }
          }
      }
      return $this;
  }
  </code></pre>
  
  <p>I know my code and loops are being called as I did </p>
  
  <pre><code>echo 'Here'; die(); 
  </code></pre>
  
  <p>through the loop to test it.</p>
  
  <p>Is this the correct way to set data for Magento products across multiple store views or have I gone wrong somewhere?</p>
  
  <p>Thanks in advance for any help/tips/pointers :-)</p>