title: Magento - add attributes to Invoice Items
body: <p>I would like to add the attribute 'epagine_download' to invoice items. I've created an Observer that listens to the sales_order_invoice_pay event.  The Idea is that the observer will fill that attribute 'epagine_download' with an url specific for the customer (and will in fact be obtained by calling an external webservice).</p>
  
  <p>I've managed to create the attribute via following code :  </p>
  
  <pre><code>    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
  $setup-&gt;addAttribute('invoice_item', 'epagine_download', array(
      'label'                       =&gt; 'Download',
      'type'                        =&gt; 'varchar',
      'input'                       =&gt; 'text'  ,
      'visible'                     =&gt; false,
      'required'                    =&gt; false  
  ))
  </code></pre>
  
  <p>This is my config of the observer :</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;config&gt;
      &lt;global&gt;
          &lt;models&gt;
              &lt;eboeksales&gt;
                  &lt;class&gt;Eboek_Sales_Model&lt;/class&gt;
              &lt;/eboeksales&gt;
          &lt;/models&gt;
          &lt;events&gt;
              &lt;sales_order_invoice_pay&gt;
                  &lt;observers&gt;
                      &lt;eboek_sales_pay_observer&gt;
                          &lt;type&gt;singleton&lt;/type&gt;
                          &lt;class&gt;Eboek_Sales_Model_Pay_Observer&lt;/class&gt;
                          &lt;method&gt;handle_sales_invoice_paid&lt;/method&gt;
                      &lt;/eboek_sales_pay_observer&gt;
  
                  &lt;/observers&gt;
              &lt;/sales_order_invoice_pay&gt;    
          &lt;/events&gt;
      &lt;/global&gt;
  
  &lt;/config&gt;
  </code></pre>
  
  <p>Now I'm stuck implementing the observer.  It seems the getData doesn't retun my new attribute "epagine_download".  What am I missing ?  I test this by creating an invoice in the adminmodule. For some reason I can't use var_dump here, so I use Mage::log.  I also call a unexisting function GetBlahBlah so I get an exception and thus preventing the invoice from being created, so I won't need create a new order each time I want to test. </p>
  
  <pre><code>class Eboek_Sales_Model_Pay_Observer {
      public function __construct()
      {
  
      }
      /**
       *
       * @param Varien_Event_Observer $observer
       * @return Eboek_Sales_Model_Pay_Observer
       */
      public function handle_sales_invoice_paid($observer)
      {
  
          $event = $observer-&gt;getEvent();
          Mage::log("Hello8812");
          $inv=$event-&gt;getInvoice();
  
          #Mage::log($inv);
          $a= $inv-&gt;getAllItems();
  
          Mage::log("=========================================================================");
          Mage::log($a[0]-&gt;getOrderItem()-&gt;getData());
          Mage::log("=========================================================================");
          Mage::log($a[0]-&gt;getData());
          Mage::log("=========================================================================");
          $event-&gt;GetBlahBlah();
  
          return $this;
      }
  }
  </code></pre>
  
  <p>(Magento version is 1.4)
  Thanks for feedback...</p>