Mage_AmazonPayments_Block_Adminhtml_Shipping_Methods Class Reference

Inheritance diagram for Mage_AmazonPayments_Block_Adminhtml_Shipping_Methods:

Mage_Adminhtml_Block_System_Config_Form_Field Mage_Adminhtml_Block_Abstract Varien_Data_Form_Element_Renderer_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _getElementHtml (Varien_Data_Form_Element_Abstract $element)
 getShippingMethods ()
 _getDisabled ()
 _getValue ($key)
 _getSelected ($value)


Detailed Description

Definition at line 27 of file Methods.php.


Member Function Documentation

_getDisabled (  )  [protected]

Definition at line 89 of file Methods.php.

00090     {
00091         return $this->getElement()->getDisabled() ? ' disabled' : '';
00092     }

_getElementHtml ( Varien_Data_Form_Element_Abstract element  )  [protected]

Enter description here...

Parameters:
Varien_Data_Form_Element_Abstract $element
Returns:
string

Reimplemented from Mage_Adminhtml_Block_System_Config_Form_Field.

Definition at line 31 of file Methods.php.

00032     {
00033         $this->setElement($element);
00034 
00035         $html = '<select name="'.$this->getElement()->getName().'[method]" '.$this->_getDisabled().'>';
00036         $html .= '<option value="None">'.$this->__(' Select shipping method').'</option>';
00037         foreach ($this->getShippingMethods() as $carrierCode=>$carrier) {
00038             $html .= '<optgroup label="'.$carrier['title'].'" style="border-top:solid 1px black; margin-top:3px;">';
00039             foreach ($carrier['methods'] as $methodCode=>$method) {
00040                 $code = $carrierCode.'/'.$methodCode;
00041                 $html .= '<option value="'.$code.'" '.$this->_getSelected($code).' style="background:white;">'.$method['title'].'</option>';
00042             }
00043             $html .= '</optgroup>';
00044         }
00045         $html .= '</select>';
00046 
00047         return $html;
00048     }

_getSelected ( value  )  [protected]

Definition at line 99 of file Methods.php.

00100     {
00101         return $this->getElement()->getData('value/method') == $value ? 'selected="selected"' : '';
00102     }

_getValue ( key  )  [protected]

Definition at line 94 of file Methods.php.

00095     {
00096         return $this->getElement()->getData('value/'.$key);
00097     }

getShippingMethods (  )  [protected]

Definition at line 50 of file Methods.php.

00051     {
00052         if (!$this->hasData('shipping_methods')) {
00053             $website = $this->getRequest()->getParam('website');
00054             $store   = $this->getRequest()->getParam('store');
00055 
00056             $storeId = null;
00057             if (!is_null($website)) {
00058                 $storeId = Mage::getModel('core/website')->load($website, 'code')->getDefaultGroup()->getDefaultStoreId();
00059             } elseif (!is_null($store)) {
00060                 $storeId = Mage::getModel('core/store')->load($store, 'code')->getId();
00061             }
00062 
00063             $methods = array();
00064             $carriers = Mage::getSingleton('shipping/config')->getActiveCarriers($storeId);
00065             foreach ($carriers as $carrierCode=>$carrierModel) {
00066                 if (!$carrierModel->isActive()) {
00067                     continue;
00068                 }
00069                 $carrierMethods = $carrierModel->getAllowedMethods();
00070                 if (!$carrierMethods) {
00071                     continue;
00072                 }
00073                 $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', $storeId);
00074                 $methods[$carrierCode] = array(
00075                     'title'   => $carrierTitle,
00076                     'methods' => array(),
00077                 );
00078                 foreach ($carrierMethods as $methodCode=>$methodTitle) {
00079                     $methods[$carrierCode]['methods'][$methodCode] = array(
00080                         'title' => '['.$carrierCode.'] '.$methodTitle,
00081                     );
00082                 }
00083             }
00084             $this->setData('shipping_methods', $methods);
00085         }
00086         return $this->getData('shipping_methods');
00087     }


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

Generated on Sat Jul 4 17:23:30 2009 for Magento by  doxygen 1.5.8