Public Member Functions | |
toOptionArray ($isActiveOnlyFlag=false) |
Definition at line 27 of file Allmethods.php.
toOptionArray | ( | $ | isActiveOnlyFlag = false |
) |
Return array of carriers. If $isActiveOnlyFlag is set to true, will return only active carriers
bool | $isActiveOnlyFlag |
Definition at line 36 of file Allmethods.php.
00037 { 00038 $methods = array(array('value'=>'', 'label'=>'')); 00039 $carriers = Mage::getSingleton('shipping/config')->getAllCarriers(); 00040 foreach ($carriers as $carrierCode=>$carrierModel) { 00041 if (!$carrierModel->isActive() && (bool)$isActiveOnlyFlag === true) { 00042 continue; 00043 } 00044 $carrierMethods = $carrierModel->getAllowedMethods(); 00045 if (!$carrierMethods) { 00046 continue; 00047 } 00048 $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title'); 00049 $methods[$carrierCode] = array( 00050 'label' => $carrierTitle, 00051 'value' => array(), 00052 ); 00053 foreach ($carrierMethods as $methodCode=>$methodTitle) { 00054 $methods[$carrierCode]['value'][] = array( 00055 'value' => $carrierCode.'_'.$methodCode, 00056 'label' => '['.$carrierCode.'] '.$methodTitle, 00057 ); 00058 } 00059 } 00060 00061 return $methods; 00062 }