title: Magento: How to filter a collection (sales/order) by a certain category?
body: <p>I spend a lot of hours to solve this problem, but I don't get it :(
  I need a selection of all ordered items from a special category. How can I filter the Collection e.g. for categoryId '44' ?</p>
  
  <p>Here my code:</p>
  
  <pre><code>&lt;?php
  require_once '/home/web/public_html/app/Mage.php';
  Mage::app();
  
  //$_category = Mage::getModel('catalog/category')-&gt;load($category_id);
  
  $salesCollection = Mage::getModel("sales/order")-&gt;getCollection();
  
  echo $salesCollection-&gt;getSelect();
  
  foreach ($salesCollection as $order) {
      $items = $order-&gt;getAllItems();
  ... ?&gt;
  </code></pre>
  
  <p>Thanks everyone for helping me,
  best, Rik</p>