title: Magento Join Product Collection to Custom Table on Custom Attribute
body: <p>In Magento, how can a standard product collection be joined to a custom table on a custom attribute.</p>
  
  <p>So for example, I have a custom product attribute warehouse_id and a custom table warehouse and now want a collection with product name, warehouse name.</p>
  
  <p>Code example:</p>
  
  <pre><code>$collection = Mage::getModel('catalog/product')
      -&gt;getCollection()
      -&gt;joinAttribute('warehouse_id', 'warehouse/warehouse', 'warehouse_id', null, 'inner');
  var_dump($collection);
  </code></pre>
  
  <p>However, this does not work because warehouse is a custom table/collection and is not in the 
  eav_entity_type table.</p>
  
  <p>Turning the problem around thought this might work:</p>
  
  <pre><code>$collection = Mage::getModel('warehouse/warehouse')-&gt;getCollection()-&gt;joinAttribute( etc.
  </code></pre>
  
  <p>However, joinAttribute is not a method on my custom collection.</p>
  
  <p>Have read every example, every post, wiki example etc. and cannot grasp how to do this.  A specific code example would be perfect.</p>