title: Magento get all products in a certain category ordered by the 'Position' field
body: <p>I am simply trying to get all products that belong to a certain <code>category ID</code> in the <code>Position</code> order they are set in the back end. </p>
  
  <p>I seemed to have tried every example available to no avail.</p>
  
  <p>The basic code I'm working with is as follows (external php file that loads magento manually):</p>
  
  <pre><code>// Load Magento
  require_once $_SERVER['DOCUMENT_ROOT'] . "/app/Mage.php";
  umask(0);
  Mage::app();
  // set Store ID
  $store_id = Mage::app()-&gt;getStore()-&gt;getStoreId();
  // set Cat ID
  $cat_id = 345;
  
  
  $cat = Mage::getModel('catalog/product')-&gt;setId(345);
  
  $products = Mage::getModel('catalog/product')
      -&gt;getCollection()
      -&gt;addCategoryFilter($cat)
      -&gt;addAttributeToSelect("*")
      -&gt;setOrder('name','asc')
      -&gt;load();
  
  foreach($products as $p) {
      var_dump($p-&gt;getName());
  }
  </code></pre>
  
  <p>How might I achieve this?</p>