Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option Class Reference

Inheritance diagram for Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option:

Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getFieldId ()
 getFieldName ()
 getProduct ()
 render (Varien_Data_Form_Element_Abstract $element)
 setElement (Varien_Data_Form_Element_Abstract $element)
 getElement ()
 isMultiWebsites ()
 getAddButtonHtml ()
 getCloseSearchButtonHtml ()
 getAddSelectionButtonHtml ()
 getOptions ()
 getAddButtonId ()
 getOptionDeleteButtonHtml ()
 getSelectionHtml ()
 getTypeSelectHtml ()
 getRequireSelectHtml ()
 isDefaultStore ()

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_element = null
 $_customerGroups = null
 $_websites = null
 $_oprions = null


Detailed Description

Definition at line 34 of file Option.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 42 of file Option.php.

00043     {
00044         $this->setTemplate('bundle/product/edit/bundle/option.phtml');
00045     }


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 92 of file Option.php.

00093     {
00094         $this->setChild('add_selection_button',
00095             $this->getLayout()->createBlock('adminhtml/widget_button')
00096                 ->setData(array(
00097                     'id'    => $this->getFieldId().'_{{index}}_add_button',
00098                     'label'     => Mage::helper('bundle')->__('Add Selection'),
00099                     'on_click'   => 'bSelection.showSearch(event)',
00100                     'class' => 'add'
00101                 )));
00102 
00103         $this->setChild('close_search_button',
00104             $this->getLayout()->createBlock('adminhtml/widget_button')
00105                 ->setData(array(
00106                     'id'    => $this->getFieldId().'_{{index}}_close_button',
00107                     'label'     => Mage::helper('bundle')->__('Close'),
00108                     'on_click'   => 'bSelection.closeSearch(event)',
00109                     'class' => 'back no-display'
00110                 )));
00111 
00112         $this->setChild('option_delete_button',
00113             $this->getLayout()->createBlock('adminhtml/widget_button')
00114                 ->setData(array(
00115                     'label' => Mage::helper('catalog')->__('Delete Option'),
00116                     'class' => 'delete delete-product-option',
00117                     'on_click' => 'bOption.remove(event)'
00118                 ))
00119         );
00120 
00121         $this->setChild('selection_template',
00122             $this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_bundle_option_selection')
00123         );
00124 
00125         return parent::_prepareLayout();
00126     }

getAddButtonHtml (  ) 

Definition at line 128 of file Option.php.

00129     {
00130         return $this->getChildHtml('add_button');
00131     }

getAddButtonId (  ) 

Definition at line 160 of file Option.php.

00161     {
00162         $buttonId = $this->getLayout()
00163                 ->getBlock('admin.product.bundle.items')
00164                 ->getChild('add_button')->getId();
00165         return $buttonId;
00166     }

getAddSelectionButtonHtml (  ) 

Definition at line 138 of file Option.php.

00139     {
00140         return $this->getChildHtml('add_selection_button');
00141     }

getCloseSearchButtonHtml (  ) 

Definition at line 133 of file Option.php.

00134     {
00135         return $this->getChildHtml('close_search_button');
00136     }

getElement (  ) 

Definition at line 82 of file Option.php.

00083     {
00084         return $this->_element;
00085     }

getFieldId (  ) 

Definition at line 47 of file Option.php.

00048     {
00049         return 'bundle_option';
00050     }

getFieldName (  ) 

Definition at line 52 of file Option.php.

00053     {
00054         return 'bundle_options';
00055     }

getOptionDeleteButtonHtml (  ) 

Definition at line 168 of file Option.php.

00169     {
00170         return $this->getChildHtml('option_delete_button');
00171     }

getOptions (  ) 

Definition at line 143 of file Option.php.

00144     {
00145         if (!$this->_options) {
00146             $this->getProduct()->getTypeInstance(true)->setStoreFilter($this->getProduct()->getStoreId(), $this->getProduct());
00147 
00148             $optionCollection = $this->getProduct()->getTypeInstance(true)->getOptionsCollection($this->getProduct());
00149 
00150             $selectionCollection = $this->getProduct()->getTypeInstance(true)->getSelectionsCollection(
00151                 $this->getProduct()->getTypeInstance(true)->getOptionsIds($this->getProduct()),
00152                 $this->getProduct()
00153             );
00154 
00155             $this->_options = $optionCollection->appendSelections($selectionCollection);
00156         }
00157         return $this->_options;
00158     }

getProduct (  ) 

Retrieve Product object

Returns:
Mage_Catalog_Model_Product

Definition at line 62 of file Option.php.

00063     {
00064         if (!$this->getData('product')) {
00065             $this->setData('product', Mage::registry('product'));
00066         }
00067         return $this->getData('product');
00068     }

getRequireSelectHtml (  ) 

Definition at line 192 of file Option.php.

00193     {
00194         $select = $this->getLayout()->createBlock('adminhtml/html_select')
00195             ->setData(array(
00196                 'id' => $this->getFieldId().'_{{index}}_required',
00197                 'class' => 'select'
00198             ))
00199             ->setName($this->getFieldName().'[{{index}}][required]')
00200             ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray());
00201 
00202         return $select->getHtml();
00203     }

getSelectionHtml (  ) 

Definition at line 173 of file Option.php.

00174     {
00175         return $this->getChildHtml('selection_template');
00176     }

getTypeSelectHtml (  ) 

Definition at line 178 of file Option.php.

00179     {
00180         $select = $this->getLayout()->createBlock('adminhtml/html_select')
00181             ->setData(array(
00182                 'id' => $this->getFieldId().'_{{index}}_type',
00183                 'class' => 'select select-product-option-type required-option-select',
00184                 'extra_params' => 'onchange="bOption.changeType(event)"'
00185             ))
00186             ->setName($this->getFieldName().'[{{index}}][type]')
00187             ->setOptions(Mage::getSingleton('bundle/source_option_type')->toOptionArray());
00188 
00189         return $select->getHtml();
00190     }

isDefaultStore (  ) 

Definition at line 205 of file Option.php.

00206     {
00207         return ($this->getProduct()->getStoreId() == '0');
00208     }

isMultiWebsites (  ) 

Definition at line 87 of file Option.php.

00088     {
00089         return !Mage::app()->isSingleStoreMode();
00090     }

render ( Varien_Data_Form_Element_Abstract element  ) 

Definition at line 70 of file Option.php.

00071     {
00072         $this->setElement($element);
00073         return $this->toHtml();
00074     }

setElement ( Varien_Data_Form_Element_Abstract element  ) 

Definition at line 76 of file Option.php.

00077     {
00078         $this->_element = $element;
00079         return $this;
00080     }


Member Data Documentation

$_customerGroups = null [protected]

Definition at line 37 of file Option.php.

$_element = null [protected]

Definition at line 36 of file Option.php.

$_oprions = null [protected]

Definition at line 40 of file Option.php.

$_websites = null [protected]

Definition at line 38 of file Option.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