Mage_Shipping_Model_Config Class Reference

Inheritance diagram for Mage_Shipping_Model_Config:

Varien_Object

List of all members.

Public Member Functions

 getActiveCarriers ($store=null)
 getAllCarriers ($store=null)
 getCarrierInstance ($carrierCode, $store=null)

Protected Member Functions

 _getCarrier ($code, $config, $store=null)

Static Protected Attributes

static $_carriers


Detailed Description

Definition at line 28 of file Config.php.


Member Function Documentation

_getCarrier ( code,
config,
store = null 
) [protected]

Definition at line 82 of file Config.php.

00083     {
00084 /*
00085         if (isset(self::$_carriers[$code])) {
00086             return self::$_carriers[$code];
00087         }
00088 */
00089         if (!isset($config['model'])) {
00090             throw Mage::exception('Mage_Shipping', 'Invalid model for shipping method: '.$code);
00091         }
00092         $modelName = $config['model'];
00093         $carrier = Mage::getModel($modelName);
00094         $carrier->setId($code)->setStore($store);
00095         self::$_carriers[$code] = $carrier;
00096         return self::$_carriers[$code];
00097     }

getActiveCarriers ( store = null  ) 

Retrieve active system carriers

Parameters:
mixed $store
Returns:
array

Definition at line 38 of file Config.php.

00039     {
00040         $carriers = array();
00041         $config = Mage::getStoreConfig('carriers', $store);
00042         foreach ($config as $code => $carrierConfig) {
00043             if (Mage::getStoreConfigFlag('carriers/'.$code.'/active', $store)) {
00044                 $carriers[$code] = $this->_getCarrier($code, $carrierConfig, $store);
00045             }
00046         }
00047         return $carriers;
00048     }

getAllCarriers ( store = null  ) 

Retrieve all system carriers

Parameters:
mixed $store
Returns:
array

Definition at line 56 of file Config.php.

00057     {
00058         $carriers = array();
00059         $config = Mage::getStoreConfig('carriers', $store);
00060         foreach ($config as $code => $carrierConfig) {
00061             $carriers[$code] = $this->_getCarrier($code, $carrierConfig, $store);
00062         }
00063         return $carriers;
00064     }

getCarrierInstance ( carrierCode,
store = null 
)

Retrieve carrier model instance by carrier code

Parameters:
string $carrierCode
mixed $store
Returns:
Mage_Usa_Model_Shipping_Carrier_Abstract

Definition at line 73 of file Config.php.

00074     {
00075         $carrierConfig =  Mage::getStoreConfig('carriers/'.$carrierCode, $store);
00076         if (!empty($carrierConfig)) {
00077             return $this->_getCarrier($carrierCode, $carrierConfig, $store);
00078         }
00079         return false;
00080     }


Member Data Documentation

$_carriers [static, protected]

Definition at line 30 of file Config.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:51 2009 for Magento by  doxygen 1.5.8