Protected Member Functions | |
_getElementHtml (Varien_Data_Form_Element_Abstract $element) | |
getShippingMethods () | |
_getDisabled () | |
_getValue ($key) | |
_getSelected ($value) |
Definition at line 27 of file Methods.php.
_getDisabled | ( | ) | [protected] |
_getElementHtml | ( | Varien_Data_Form_Element_Abstract $ | element | ) | [protected] |
Enter description here...
Varien_Data_Form_Element_Abstract | $element |
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] |
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 }