Mage_Sales_Model_Order_Config Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Config:

Mage_Core_Model_Config_Base Varien_Simplexml_Config

List of all members.

Public Member Functions

 __construct ()
 getStateDefaultStatus ($state)
 getStatusLabel ($status)
 getStatuses ()
 getStateStatuses ($state, $addLabels=true)
 getVisibleOnFrontStates ()
 getInvisibleOnFrontStates ()

Protected Member Functions

 _getStatus ($status)
 _getState ($state)


Detailed Description

Definition at line 34 of file Config.php.


Constructor & Destructor Documentation

__construct (  ) 

Definition at line 38 of file Config.php.

00039     {
00040         parent::__construct(Mage::getConfig()->getNode('global/sales/order'));
00041     }


Member Function Documentation

_getState ( state  )  [protected]

Definition at line 48 of file Config.php.

00049     {
00050         return $this->getNode('states/'.$state);
00051     }

_getStatus ( status  )  [protected]

Definition at line 43 of file Config.php.

00044     {
00045         return $this->getNode('statuses/'.$status);
00046     }

getInvisibleOnFrontStates (  ) 

Get order states, visible on frontend

Returns:
array

Definition at line 155 of file Config.php.

00156     {
00157         $this->_getStates();
00158         return $this->_states['invisible'];
00159     }

getStateDefaultStatus ( state  ) 

Retrieve default status for state

Parameters:
string $state
Returns:
string

Definition at line 59 of file Config.php.

00060     {
00061         $status = false;
00062         if ($stateNode = $this->_getState($state)) {
00063             if ($stateNode->statuses) {
00064                 foreach ($stateNode->statuses->children() as $statusNode) {
00065                     if (!$status) {
00066                         $status = $statusNode->getName();
00067                     }
00068                     $attributes = $statusNode->attributes();
00069                     if (isset($attributes['default'])) {
00070                         $status = $statusNode->getName();
00071                     }
00072                 }
00073             }
00074         }
00075         return $status;
00076     }

getStateStatuses ( state,
addLabels = true 
)

Retrieve statuses available for state Get all possible statuses, or for specified state, or specified states array Add labels by default. Return plain array of statuses, if no labels.

Parameters:
mixed $state
bool $addLabels
Returns:
array

Definition at line 117 of file Config.php.

00118     {
00119         $statuses = array();
00120         if (empty($state) || !is_array($state)) {
00121             $state = array($state);
00122         }
00123         foreach ($state as $_state) {
00124             if ($stateNode = $this->_getState($_state)) {
00125                 foreach ($stateNode->statuses->children() as $statusNode) {
00126                     $status = $statusNode->getName();
00127                     if ($addLabels) {
00128                         $statuses[$status] = $this->getStatusLabel($status);
00129                     }
00130                     else {
00131                         $statuses[] = $status;
00132                     }
00133                 }
00134             }
00135         }
00136         return $statuses;
00137     }

getStatuses (  ) 

Retrieve all statuses

Returns:
array

Definition at line 98 of file Config.php.

00099     {
00100         $statuses = array();
00101         foreach ($this->getNode('statuses')->children() as $status) {
00102             $label = (string) $status->label;
00103             $statuses[$status->getName()] = Mage::helper('sales')->__($label);
00104         }
00105         return $statuses;
00106     }

getStatusLabel ( status  ) 

Retrieve status label

Parameters:
string $status
Returns:
string

Definition at line 84 of file Config.php.

00085     {
00086         if ($statusNode = $this->_getStatus($status)) {
00087             $status = (string) $statusNode->label;
00088             return Mage::helper('sales')->__($status);
00089         }
00090         return $status;
00091     }

getVisibleOnFrontStates (  ) 

Retrieve states which are visible on front end

Returns:
array

Definition at line 144 of file Config.php.

00145     {
00146         $this->_getStates();
00147         return $this->_states['visible'];
00148     }


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

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