Public Member Functions | |
getElementHtml () | |
getProduct () | |
Public Attributes | |
const | DYNAMIC = 0 |
const | FIXED = 1 |
Definition at line 34 of file Extend.php.
getElementHtml | ( | ) |
Retrieve element html
Reimplemented from Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element.
Definition at line 39 of file Extend.php.
00040 { 00041 $elementHtml = parent::getElementHtml(); 00042 00043 $switchAttributeCode = $this->getAttribute()->getAttributeCode().'_type'; 00044 $switchAttributeValue = $this->getProduct()->getData($switchAttributeCode); 00045 00046 $html = '<select name="product[' . $switchAttributeCode . ']" id="' . $switchAttributeCode . '" type="select" class="required-entry select next-toinput"' . ($this->getProduct()->getId() && $this->getAttribute()->getAttributeCode() == 'price' || $this->getElement()->getReadonly() ? ' disabled="disabled"' : '') . '> 00047 <option value="">' . $this->__('--Select--') . '</option> 00048 <option ' . ($switchAttributeValue == self::DYNAMIC ? 'selected' : '') . ' value="' . self::DYNAMIC . '">' . $this->__('Dynamic') . '</option> 00049 <option ' . ($switchAttributeValue == self::FIXED ? 'selected' : '') . ' value="' . self::FIXED . '">' . $this->__('Fixed') . '</option> 00050 </select>'; 00051 00052 $html .= '<span class="next-toselect">'.$elementHtml.'</span>'; 00053 if ($this->getDisableChild() && !$this->getElement()->getReadonly()) { 00054 $html .= "<script type=\"text/javascript\"> 00055 function " . $switchAttributeCode . "_change() { 00056 if ($('" . $switchAttributeCode . "').value == '" . self::DYNAMIC . "') { 00057 $('" . $this->getAttribute()->getAttributeCode() . "').disabled = true; 00058 $('" . $this->getAttribute()->getAttributeCode() . "').value = ''; 00059 $('" . $this->getAttribute()->getAttributeCode() . "').removeClassName('required-entry'); 00060 00061 if ($('dynamic-price-warrning')) { 00062 $('dynamic-price-warrning').show(); 00063 } 00064 } else { 00065 $('" . $this->getAttribute()->getAttributeCode() . "').disabled = false; 00066 $('" . $this->getAttribute()->getAttributeCode() . "').addClassName('required-entry'); 00067 00068 if ($('dynamic-price-warrning')) { 00069 $('dynamic-price-warrning').hide(); 00070 } 00071 } 00072 } 00073 00074 $('" . $switchAttributeCode . "').observe('change', " . $switchAttributeCode . "_change); 00075 " . $switchAttributeCode . "_change(); 00076 </script>"; 00077 } 00078 return $html; 00079 }
getProduct | ( | ) |
Definition at line 81 of file Extend.php.
00082 { 00083 if (!$this->getData('product')){ 00084 $this->setData('product', Mage::registry('product')); 00085 } 00086 return $this->getData('product'); 00087 }
const DYNAMIC = 0 |
Definition at line 36 of file Extend.php.
const FIXED = 1 |
Definition at line 37 of file Extend.php.