I hope you mean sort collection by category id, check this you may need to modify this code:

$products = Mage::getModel( 'catalog/product' )
    -&gt;getCollection()
    -&gt;addAttributeToSelect( '*' )
    -&gt;addFieldToFilter( 'status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED )
    -&gt;addFieldToFilter( 'visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH );
    -&gt;addAttributeToFilter( 'category_id', array( 'in' =&gt; array( 'finset' =&gt; '[CATEGORY_ID_HERE]' ) ) );
    -&gt;addAttributeToSort( 'category_id', ASC )
    -&gt;addAttributeToSort( 'name', ASC );


Show, sort , and limit by products based on subcategory on category page

  Possible Duplicate:
  Can&rsquo;t edit a specific document in Word 2007  


How do I remove the password protection (unprotect) on a Word document if I don't know the password? (i.e. The protection provided by Tools > Unprotect Document)
