Protected Member Functions | |
_getElementHtml (Varien_Data_Form_Element_Abstract $element) | |
_getRowTemplateHtml ($i=0) | |
getShippingMethods () | |
_getDisabled () | |
_getValue ($key) | |
_getSelected ($key, $value) | |
_getAddRowButtonHtml ($container, $template, $title='Add') | |
_getRemoveRowButtonHtml ($selector='li', $title='Remove') | |
Protected Attributes | |
$_addRowButtonHtml = array() | |
$_removeRowButtonHtml = array() |
Definition at line 27 of file Merchant.php.
_getAddRowButtonHtml | ( | $ | container, | |
$ | template, | |||
$ | title = 'Add' | |||
) | [protected] |
Definition at line 136 of file Merchant.php.
00137 { 00138 if (!isset($this->_addRowButtonHtml[$container])) { 00139 $this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button') 00140 ->setType('button') 00141 ->setClass('add '.$this->_getDisabled()) 00142 ->setLabel($this->__($title)) 00143 //$this->__('Add') 00144 ->setOnClick("Element.insert($('".$container."'), {bottom: $('".$template."').innerHTML})") 00145 ->setDisabled($this->_getDisabled()) 00146 ->toHtml(); 00147 } 00148 return $this->_addRowButtonHtml[$container]; 00149 }
_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 33 of file Merchant.php.
00034 { 00035 $this->setElement($element); 00036 00037 $html = '<div id="merchant_allowed_methods_template" style="display:none">'; 00038 $html .= $this->_getRowTemplateHtml(); 00039 $html .= '</div>'; 00040 00041 $html .= '<ul id="merchant_allowed_methods_container">'; 00042 if ($this->_getValue('method')) { 00043 foreach ($this->_getValue('method') as $i=>$f) { 00044 if ($i) { 00045 $html .= $this->_getRowTemplateHtml($i); 00046 } 00047 } 00048 } 00049 $html .= '</ul>'; 00050 $html .= $this->_getAddRowButtonHtml('merchant_allowed_methods_container', 00051 'merchant_allowed_methods_template', $this->__('Add Shipping Method')); 00052 00053 return $html; 00054 }
_getRemoveRowButtonHtml | ( | $ | selector = 'li' , |
|
$ | title = 'Remove' | |||
) | [protected] |
Definition at line 151 of file Merchant.php.
00152 { 00153 if (!$this->_removeRowButtonHtml) { 00154 $this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button') 00155 ->setType('button') 00156 ->setClass('delete v-middle '.$this->_getDisabled()) 00157 ->setLabel($this->__($title)) 00158 //$this->__('Remove') 00159 ->setOnClick("Element.remove($(this).up('".$selector."'))") 00160 ->setDisabled($this->_getDisabled()) 00161 ->toHtml(); 00162 } 00163 return $this->_removeRowButtonHtml; 00164 }
_getRowTemplateHtml | ( | $ | i = 0 |
) | [protected] |
Definition at line 56 of file Merchant.php.
00057 { 00058 $html = '<li>'; 00059 $html .= '<select name="'.$this->getElement()->getName().'[method][]" '.$this->_getDisabled().'>'; 00060 $html .= '<option value="">'.$this->__('* Select shipping method').'</option>'; 00061 foreach ($this->getShippingMethods() as $carrierCode=>$carrier) { 00062 $html .= '<optgroup label="'.$carrier['title'].'" style="border-top:solid 1px black; margin-top:3px;">'; 00063 foreach ($carrier['methods'] as $methodCode=>$method) { 00064 $code = $carrierCode.'/'.$methodCode; 00065 $html .= '<option value="'.$code.'" '.$this->_getSelected('method/'.$i, $code).' style="background:white;">'.$method['title'].'</option>'; 00066 } 00067 $html .= '</optgroup>'; 00068 } 00069 $html .= '</select>'; 00070 00071 $html .= '<div style="margin:5px 0 10px;">'; 00072 $html .= '<label>'.$this->__('Default price:').'</label> '; 00073 $html .= '<input class="input-text" style="width:70px;" name="'.$this->getElement()->getName().'[price][]" value="'.$this->_getValue('price/'.$i).'" '.$this->_getDisabled().'/> '; 00074 00075 $html .= $this->_getRemoveRowButtonHtml(); 00076 $html .= '</div>'; 00077 $html .= '</li>'; 00078 00079 return $html; 00080 }
_getSelected | ( | $ | key, | |
$ | value | |||
) | [protected] |
Definition at line 131 of file Merchant.php.
00132 { 00133 return $this->getElement()->getData('value/'.$key)==$value ? 'selected="selected"' : ''; 00134 }
_getValue | ( | $ | key | ) | [protected] |
getShippingMethods | ( | ) | [protected] |
Definition at line 82 of file Merchant.php.
00083 { 00084 if (!$this->hasData('shipping_methods')) { 00085 $website = $this->getRequest()->getParam('website'); 00086 $store = $this->getRequest()->getParam('store'); 00087 00088 $storeId = null; 00089 if (!is_null($website)) { 00090 $storeId = Mage::getModel('core/website')->load($website, 'code')->getDefaultGroup()->getDefaultStoreId(); 00091 } elseif (!is_null($store)) { 00092 $storeId = Mage::getModel('core/store')->load($store, 'code')->getId(); 00093 } 00094 00095 $methods = array(); 00096 $carriers = Mage::getSingleton('shipping/config')->getActiveCarriers($storeId); 00097 foreach ($carriers as $carrierCode=>$carrierModel) { 00098 if (!$carrierModel->isActive()) { 00099 continue; 00100 } 00101 $carrierMethods = $carrierModel->getAllowedMethods(); 00102 if (!$carrierMethods) { 00103 continue; 00104 } 00105 $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', $storeId); 00106 $methods[$carrierCode] = array( 00107 'title' => $carrierTitle, 00108 'methods' => array(), 00109 ); 00110 foreach ($carrierMethods as $methodCode=>$methodTitle) { 00111 $methods[$carrierCode]['methods'][$methodCode] = array( 00112 'title' => '['.$carrierCode.'] '.$methodTitle, 00113 ); 00114 } 00115 } 00116 $this->setData('shipping_methods', $methods); 00117 } 00118 return $this->getData('shipping_methods'); 00119 }
$_addRowButtonHtml = array() [protected] |
Definition at line 30 of file Merchant.php.
$_removeRowButtonHtml = array() [protected] |
Definition at line 31 of file Merchant.php.