title: Creating attribute sets and attributes programmatically
body: <p>I am using the code listed on the following link: </p>
  
  <p><a href="http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/programmatically_adding_attributes_and_attribute_sets" rel="nofollow">http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/programmatically_adding_attributes_and_attribute_sets</a></p>
  
  <p>Everything works until the point: </p>
  
  <pre><code>    // Just add a default group.
      else
      {
          $this-&gt;logInfo("Creating default group [{$this-&gt;groupName}] for set.");
  
          $modelGroup = Mage::getModel('eav/entity_attribute_group');
          $modelGroup-&gt;setAttributeGroupName($this-&gt;groupName);
          $modelGroup-&gt;setAttributeSetId($id);
  
          // This is optional, and just a sorting index in the case of
          // multiple groups.
          // $modelGroup-&gt;setSortOrder(1);
  
          $model-&gt;setGroups(array($modelGroup));
      }
  </code></pre>
  
  <p>I am unsure where the object reference would need to be set from - I am attempting to have this as a separate file that can be automated - I am running this file by doing a </p>
  
  <pre><code>require_once 'app/Mage.php'; 
  Mage::app(); 
  </code></pre>
  
  <p>Any help in this would be greatly appreciated </p>