title: how to count items in an order(when item status=Mixed) using orderid in magento?
body: <p>I am trying to count total number of items in an order but I am unable to do so correctly.
  I am using this code -</p>
  
  <pre><code>$total=0;
  $order = Mage::getModel('sales/order')-&gt;load($oid);
  $items = $order-&gt;getAllItems();
  
  foreach($items as $item){
  $qty = $item-&gt;getQtyToInvoice();
  $total = $total + $qty;
  }
  echo "total :".$total;  
  </code></pre>
  
  <p>This print correct result if the items status in orders  is shipped but if the item status is mixed ,it prints 0 .</p>