title: How to get and show data from different models in Cakephp
body: <p>I have 3 tables: <code>orders</code>, <code>discounts</code> and <code>products</code> in the way that <code>product</code> has many <code>discounts</code> (discount times). <code>Discount</code> has many <code>orders</code>. in other words, it looks like: <code>Product &gt; Discount &gt; Order.</code></p>
  
  <p>How can I get all data from 3 table, put it into one order view (do it in <code>Order</code> controller) and show it out (in <code>Order</code> view).</p>
  
  <p>That's what I did, but It didnt work:</p>
  
  <pre><code>//Order controller
  public function index() {
      $this-&gt;Order-&gt;recursive=1;
      $this-&gt;set('orders', $this-&gt;Order-&gt;find('all'));
  }
  
  
  // Order view
  &lt;?php foreach ($orders as $order): ?&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $order ['Order']['order_id']; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $this-&gt;Html-&gt;link($order['Product']['product_name'], array('controller' =&gt; 'products', 'action' =&gt; 'view', $order['Product']['product_id'])); ?&gt;&lt;/td&gt;     //I showed it here
              &lt;td&gt;&lt;?php echo $order['Order']['order_date']; ?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $order['Order']['payment']; ?&gt;&lt;/td&gt;
  &lt;?php endforeach; ?&gt;
  &lt;?php unset($order); ?&gt;
  </code></pre>
  
  <p>Please help me! thanks in advance.</p>