title: Magento: Get Product Backordered Quantity in New Order Email
body: <p>I'm trying to add the number of backorder products to the email template that comes out in the new order email.</p>
  
  <p>So far I've managed to get the product but I just can't seem to get it's quantity. I've tried a variety of methods but nothing seems to work. Here is my latest attempt:</p>
  
  <p>The file is <strong>app/design/frontend/base/default/template/email/order/items/order/default/phtml</strong></p>
  
  <pre><code>&lt;?php 
      // 1. Get Qty of Product in Store. 
      // 2. Get Qty of product from order
      // 3. IF qty from order &gt; qty in store then get number over
      // 4. Display number over
  
      $_sku = $this-&gt;getItem()-&gt;getSku();
      $_product = Mage::getModel('catalog/product')-&gt;loadByAttribute('sku', $_sku);
      //print_r($_product);
      echo 'qty in shop: '.$qtyInStock = $_product-&gt;getStockItem()-&gt;getQty(); //debugging
      echo 'qty ordered: '.$qtyOrdered = $_item-&gt;getQtyOrdered()*1; //debugging
  ?&gt;
  
  &lt;?php if($qtyOrdered &gt; $qtyInStock): $back_order = $qtyOrdered - $qtyInStock; ?&gt;
      &lt;p&gt;* This product is not available in the requested quantity. &lt;?php echo $back_order; ?&gt; of the item(s) will be backordered.&lt;/p&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>I'm not finished with the logic yet. I'm just stuck on getting the products quantity.</p>
  
  <pre><code>$_product-&gt;getStockItem()-&gt;getQty();
  </code></pre>
  
  <p>Any help most appreciated.</p>
  
  <p>Billy</p>