Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Bundle_Adminhtml_Bundle_Product_EditController
  • Mage_Bundle_Adminhtml_Bundle_SelectionController
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Checkbox
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Multi
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Radio
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Options_Type_Select
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Extend
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Special
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection
  • Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
  • Mage_Bundle_Block_Adminhtml_Sales_Order_Items_Renderer
  • Mage_Bundle_Block_Adminhtml_Sales_Order_View_Items_Renderer
  • Mage_Bundle_Block_Catalog_Product_List_Partof
  • Mage_Bundle_Block_Catalog_Product_Price
  • Mage_Bundle_Block_Catalog_Product_View
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Multi
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
  • Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select
  • Mage_Bundle_Block_Checkout_Cart_Item_Renderer
  • Mage_Bundle_Block_Sales_Order_Items_Renderer
  • Mage_Bundle_Helper_Catalog_Product_Configuration
  • Mage_Bundle_Helper_Data
  • Mage_Bundle_Model_CatalogIndex_Data_Bundle
  • Mage_Bundle_Model_Mysql4_Bundle
  • Mage_Bundle_Model_Mysql4_Indexer_Price
  • Mage_Bundle_Model_Mysql4_Indexer_Stock
  • Mage_Bundle_Model_Mysql4_Option
  • Mage_Bundle_Model_Mysql4_Option_Collection
  • Mage_Bundle_Model_Mysql4_Price_Index
  • Mage_Bundle_Model_Mysql4_Selection
  • Mage_Bundle_Model_Mysql4_Selection_Collection
  • Mage_Bundle_Model_Observer
  • Mage_Bundle_Model_Option
  • Mage_Bundle_Model_Price_Index
  • Mage_Bundle_Model_Product_Attribute_Source_Price_View
  • Mage_Bundle_Model_Product_Price
  • Mage_Bundle_Model_Product_Type
  • Mage_Bundle_Model_Resource_Bundle
  • Mage_Bundle_Model_Resource_Indexer_Price
  • Mage_Bundle_Model_Resource_Indexer_Stock
  • Mage_Bundle_Model_Resource_Option
  • Mage_Bundle_Model_Resource_Option_Collection
  • Mage_Bundle_Model_Resource_Price_Index
  • Mage_Bundle_Model_Resource_Selection
  • Mage_Bundle_Model_Resource_Selection_Collection
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract
  • Mage_Bundle_Model_Sales_Order_Pdf_Items_Shipment
  • Mage_Bundle_Model_Selection
  • Mage_Bundle_Model_Source_Option_Selection_Price_Type
  • Mage_Bundle_Model_Source_Option_Type
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Bundle
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Bundle option renderer
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Bundle
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option extends Mage_Adminhtml_Block_Widget
 35: {
 36:     /**
 37:      * Form element
 38:      *
 39:      * @var Varien_Data_Form_Element_Abstract|null
 40:      */
 41:     protected $_element = null;
 42: 
 43:     /**
 44:      * List of customer groups
 45:      *
 46:      * @deprecated since 1.7.0.0
 47:      * @var array|null
 48:      */
 49:     protected $_customerGroups = null;
 50: 
 51:     /**
 52:      * List of websites
 53:      *
 54:      * @deprecated since 1.7.0.0
 55:      * @var array|null
 56:      */
 57:     protected $_websites = null;
 58: 
 59:     /**
 60:      * List of bundle product options
 61:      *
 62:      * @var array|null
 63:      */
 64:     protected $_options = null;
 65: 
 66:     /**
 67:      * Bundle option renderer class constructor
 68:      *
 69:      * Sets block template and necessary data
 70:      */
 71:     public function __construct()
 72:     {
 73:         $this->setTemplate('bundle/product/edit/bundle/option.phtml');
 74:         $this->setCanReadPrice(true);
 75:         $this->setCanEditPrice(true);
 76:     }
 77: 
 78:     public function getFieldId()
 79:     {
 80:         return 'bundle_option';
 81:     }
 82: 
 83:     public function getFieldName()
 84:     {
 85:         return 'bundle_options';
 86:     }
 87: 
 88:     /**
 89:      * Retrieve Product object
 90:      *
 91:      * @return Mage_Catalog_Model_Product
 92:      */
 93:     public function getProduct()
 94:     {
 95:         if (!$this->getData('product')) {
 96:             $this->setData('product', Mage::registry('product'));
 97:         }
 98:         return $this->getData('product');
 99:     }
100: 
101:     public function render(Varien_Data_Form_Element_Abstract $element)
102:     {
103:         $this->setElement($element);
104:         return $this->toHtml();
105:     }
106: 
107:     public function setElement(Varien_Data_Form_Element_Abstract $element)
108:     {
109:         $this->_element = $element;
110:         return $this;
111:     }
112: 
113:     public function getElement()
114:     {
115:         return $this->_element;
116:     }
117: 
118:     public function isMultiWebsites()
119:     {
120:         return !Mage::app()->isSingleStoreMode();
121:     }
122: 
123:     protected function _prepareLayout()
124:     {
125:         $this->setChild('add_selection_button',
126:             $this->getLayout()->createBlock('adminhtml/widget_button')
127:                 ->setData(array(
128:                     'id'    => $this->getFieldId().'_{{index}}_add_button',
129:                     'label'     => Mage::helper('bundle')->__('Add Selection'),
130:                     'on_click'   => 'bSelection.showSearch(event)',
131:                     'class' => 'add'
132:                 )));
133: 
134:         $this->setChild('close_search_button',
135:             $this->getLayout()->createBlock('adminhtml/widget_button')
136:                 ->setData(array(
137:                     'id'    => $this->getFieldId().'_{{index}}_close_button',
138:                     'label'     => Mage::helper('bundle')->__('Close'),
139:                     'on_click'   => 'bSelection.closeSearch(event)',
140:                     'class' => 'back no-display'
141:                 )));
142: 
143:         $this->setChild('option_delete_button',
144:             $this->getLayout()->createBlock('adminhtml/widget_button')
145:                 ->setData(array(
146:                     'label' => Mage::helper('catalog')->__('Delete Option'),
147:                     'class' => 'delete delete-product-option',
148:                     'on_click' => 'bOption.remove(event)'
149:                 ))
150:         );
151: 
152:         $this->setChild('selection_template',
153:             $this->getLayout()->createBlock('bundle/adminhtml_catalog_product_edit_tab_bundle_option_selection')
154:         );
155: 
156:         return parent::_prepareLayout();
157:     }
158: 
159:     public function getAddButtonHtml()
160:     {
161:         return $this->getChildHtml('add_button');
162:     }
163: 
164:     public function getCloseSearchButtonHtml()
165:     {
166:         return $this->getChildHtml('close_search_button');
167:     }
168: 
169:     public function getAddSelectionButtonHtml()
170:     {
171:         return $this->getChildHtml('add_selection_button');
172:     }
173: 
174:     /**
175:      * Retrieve list of bundle product options
176:      *
177:      * @return array
178:      */
179:     public function getOptions()
180:     {
181:         if (!$this->_options) {
182:             $this->getProduct()->getTypeInstance(true)->setStoreFilter($this->getProduct()->getStoreId(),
183:                 $this->getProduct());
184: 
185:             $optionCollection = $this->getProduct()->getTypeInstance(true)->getOptionsCollection($this->getProduct());
186: 
187:             $selectionCollection = $this->getProduct()->getTypeInstance(true)->getSelectionsCollection(
188:                 $this->getProduct()->getTypeInstance(true)->getOptionsIds($this->getProduct()),
189:                 $this->getProduct()
190:             );
191: 
192:             $this->_options = $optionCollection->appendSelections($selectionCollection);
193:             if ($this->getCanReadPrice() === false) {
194:                 foreach ($this->_options as $option) {
195:                     if ($option->getSelections()) {
196:                         foreach ($option->getSelections() as $selection) {
197:                             $selection->setCanReadPrice($this->getCanReadPrice());
198:                             $selection->setCanEditPrice($this->getCanEditPrice());
199:                         }
200:                     }
201:                 }
202:             }
203:         }
204:         return $this->_options;
205:     }
206: 
207:     public function getAddButtonId()
208:     {
209:         $buttonId = $this->getLayout()
210:                 ->getBlock('admin.product.bundle.items')
211:                 ->getChild('add_button')->getId();
212:         return $buttonId;
213:     }
214: 
215:     public function getOptionDeleteButtonHtml()
216:     {
217:         return $this->getChildHtml('option_delete_button');
218:     }
219: 
220:     public function getSelectionHtml()
221:     {
222:         return $this->getChildHtml('selection_template');
223:     }
224: 
225:     public function getTypeSelectHtml()
226:     {
227:         $select = $this->getLayout()->createBlock('adminhtml/html_select')
228:             ->setData(array(
229:                 'id' => $this->getFieldId().'_{{index}}_type',
230:                 'class' => 'select select-product-option-type required-option-select',
231:                 'extra_params' => 'onchange="bOption.changeType(event)"'
232:             ))
233:             ->setName($this->getFieldName().'[{{index}}][type]')
234:             ->setOptions(Mage::getSingleton('bundle/source_option_type')->toOptionArray());
235: 
236:         return $select->getHtml();
237:     }
238: 
239:     public function getRequireSelectHtml()
240:     {
241:         $select = $this->getLayout()->createBlock('adminhtml/html_select')
242:             ->setData(array(
243:                 'id' => $this->getFieldId().'_{{index}}_required',
244:                 'class' => 'select'
245:             ))
246:             ->setName($this->getFieldName().'[{{index}}][required]')
247:             ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray());
248: 
249:         return $select->getHtml();
250:     }
251: 
252:     public function isDefaultStore()
253:     {
254:         return ($this->getProduct()->getStoreId() == '0');
255:     }
256: }
257: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0