title: How to use custom customer variables in transactional email templates in magento?
body: <p>I have added some custom variables to customer and I want to use them in email template.</p>
  
  <p>Here's example how I have added a variable to customer in my installer:</p>
  
  <pre><code>$setup-&gt;addAttribute('customer', 'companyname', array(
      'input'         =&gt; 'text',
      'type'          =&gt; 'varchar',
      'label'         =&gt; 'Company name',
      'visible'       =&gt; 1,
      'required'      =&gt; 1,
      'user_defined' =&gt; 1,
  ));
  
  $setup-&gt;addAttributeToGroup(
   $entityTypeId,
   $attributeSetId,
   $attributeGroupId,
   'companyname',
   '999'  //sort_order
  );
  
  $oAttribute = Mage::getSingleton('eav/config')-&gt;getAttribute('customer', 'companyname');
  $oAttribute-&gt;setData('used_in_forms', array('adminhtml_customer','customer_account_create'));
  $oAttribute-&gt;save();
  </code></pre>
  
  <p>I try to use this variable in email template:</p>
  
  <pre><code>{{var order.getCustomer().getCompanyname()}}
  </code></pre>
  
  <p>But it's not showing. How to make it work?</p>