Which of the following will retrieve a list of all shipping methods in Magento?

  • public function toOptionArray($isMultiSelect = false) { $methods = Mage::getSingleton(‘shipping/config’)->getActiveCarriers(); $options = array(); foreach($methods as $_code => $_method) { if(!$_title = Mage::getStoreConfig(“carriers/$_code/title”)) $_title = $_code; $options[] = array(‘value’ => $_code, ‘label’ => $_title . ” ($_code)”); } if($isMultiSelect) { array_unshift($options, array(‘value’=>”, ‘label’=> Mage::helper(‘adminhtml’)->__(‘–Please Select–‘))); } return $options; }

  • $salesQuoteRate = Mage::getModel(‘sales/quote_address_rate’)->load($rate_id); if($salesQuoteRate){ echo ‘
    CODE : ‘.$salesQuoteRate->getCode(); echo ‘
    METHOD : ‘.$salesQuoteRate->getMethod(); }

  • $iOrderId = Mage::getSingleton(‘checkout/session’)->getLastRealOrderId(); $oOrder = Mage::getModel(‘sales/order’)->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();

  • echo Mage::getSingleton(‘checkout/session’)->getQuote()->getShippingAddress()->getShippingMethod();

stackoverflow.com/a/9434369