title: Programmatically retrieve list of all shipping methods
body: <p>I'm writing a quick-and-dirty module to restrict shipping methods based on products in the cart.  For example, if the customer adds food, I only want overnight shipping methods to be selected.  Some of the commercial extensions are just overkill and have way more functionality that I need.</p>
  
  <p>Each product will have a dropdown attribute called "Shipping Class".  The admin will be able to create these Shipping Classes in the backend.  They will give it a name and choose which methods are allowed.</p>
  
  <p>When it comes time to get shipping quotes, we'll only show allowed methods based on the Shipping Class.</p>
  
  <p><strong>My main question is: how can I retrieve a list of all the shipping methods for the admin to select from when creating these shipping classes?</strong></p>
  
  <p>And as a secondary question, does it make sense to do the filtering of allowed methods inside of Mage_Sales_Model_Quote_Address::requestShippingRates?  (I will be overriding this method of course)</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thanks to @BrianVPS, I was able to come up with the code below.  It displays all individual methods from the carriers using optgroups.  Works great with multiselect!  I don't think it checks if the methods are actually enabled though.</p>
  
  <pre><code>public function getAllShippingMethods()
  {
      $methods = Mage::getSingleton('shipping/config')-&gt;getActiveCarriers();
  
      $options = array();
  
      foreach($methods as $_ccode =&gt; $_carrier)
      {
          $_methodOptions = array();
          if($_methods = $_carrier-&gt;getAllowedMethods())
          {
              foreach($_methods as $_mcode =&gt; $_method)
              {
                  $_code = $_ccode . '_' . $_mcode;
                  $_methodOptions[] = array('value' =&gt; $_code, 'label' =&gt; $_method);
              }
  
              if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
                  $_title = $_ccode;
  
              $options[] = array('value' =&gt; $_methodOptions, 'label' =&gt; $_title);
          }
      }
  
      return $options;
  }
  </code></pre>