Mage_Payment_Model_Config Class Reference

List of all members.

Public Member Functions

 getActiveMethods ($store=null)
 getAllMethods ($store=null)
 getCcTypes ()
 getMonths ()
 getYears ()

Static Public Member Functions

static compareCcTypes ($a, $b)

Protected Member Functions

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

Static Protected Attributes

static $_methods


Detailed Description

Definition at line 36 of file Config.php.


Member Function Documentation

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

Definition at line 74 of file Config.php.

00075     {
00076         if (isset(self::$_methods[$code])) {
00077             return self::$_methods[$code];
00078         }
00079         $modelName = $config['model'];
00080         $method = Mage::getModel($modelName);
00081         $method->setId($code)->setStore($store);
00082         self::$_methods[$code] = $method;
00083         return self::$_methods[$code];
00084     }

static compareCcTypes ( a,
b 
) [static]

Statis Method for compare sort order of CC Types

Parameters:
array $a
array $b
Returns:
int

Definition at line 143 of file Config.php.

00144     {
00145         if (!isset($a['order'])) {
00146             $a['order'] = 0;
00147         }
00148 
00149         if (!isset($b['order'])) {
00150             $b['order'] = 0;
00151         }
00152 
00153         if ($a['order'] == $b['order']) {
00154             return 0;
00155         } else if ($a['order'] > $b['order']) {
00156             return 1;
00157         } else {
00158             return -1;
00159         }
00160 
00161     }

getActiveMethods ( store = null  ) 

Retrieve active system payments

Parameters:
mixed $store
Returns:
array

Definition at line 46 of file Config.php.

00047     {
00048         $methods = array();
00049         $config = Mage::getStoreConfig('payment', $store);
00050         foreach ($config as $code => $methodConfig) {
00051             if (Mage::getStoreConfigFlag('payment/'.$code.'/active', $store)) {
00052                 $methods[$code] = $this->_getMethod($code, $methodConfig);
00053             }
00054         }
00055         return $methods;
00056     }

getAllMethods ( store = null  ) 

Retrieve all system payments

Parameters:
mixed $store
Returns:
array

Definition at line 64 of file Config.php.

00065     {
00066         $methods = array();
00067         $config = Mage::getStoreConfig('payment', $store);
00068         foreach ($config as $code => $methodConfig) {
00069             $methods[$code] = $this->_getMethod($code, $methodConfig);
00070         }
00071         return $methods;
00072     }

getCcTypes (  ) 

Retrieve array of credit card types

Returns:
array

Definition at line 91 of file Config.php.

00092     {
00093         $_types = Mage::getConfig()->getNode('global/payment/cc/types')->asArray();
00094 
00095         uasort($_types, array('Mage_Payment_Model_Config', 'compareCcTypes'));
00096 
00097         $types = array();
00098         foreach ($_types as $data) {
00099             $types[$data['code']] = $data['name'];
00100         }
00101         return $types;
00102     }

getMonths (  ) 

Retrieve list of months translation

Returns:
array

Definition at line 109 of file Config.php.

00110     {
00111         $data = Mage::app()->getLocale()->getTranslationList('month');
00112         foreach ($data as $key => $value) {
00113             $monthNum = ($key < 10) ? '0'.$key : $key;
00114             $data[$key] = $monthNum . ' - ' . $value;
00115         }
00116         return $data;
00117     }

getYears (  ) 

Retrieve array of available years

Returns:
array

Definition at line 124 of file Config.php.

00125     {
00126         $years = array();
00127         $first = date("Y");
00128 
00129         for ($index=0; $index <= 10; $index++) {
00130             $year = $first + $index;
00131             $years[$year] = $year;
00132         }
00133         return $years;
00134     }


Member Data Documentation

$_methods [static, protected]

Definition at line 38 of file Config.php.


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

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