Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend Class Reference

Inheritance diagram for Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend:

Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element Mage_Adminhtml_Block_Template Varien_Data_Form_Element_Renderer_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getElementHtml ()
 getProduct ()

Public Attributes

const DYNAMIC = 0
const FIXED = 1


Detailed Description

Definition at line 34 of file Extend.php.


Member Function Documentation

getElementHtml (  ) 

Retrieve element html

Returns:
string

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     }


Member Data Documentation

const DYNAMIC = 0

Definition at line 36 of file Extend.php.

const FIXED = 1

Definition at line 37 of file Extend.php.


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

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