00001 <?php 00002 /** 00003 * Magento 00004 * 00005 * NOTICE OF LICENSE 00006 * 00007 * This source file is subject to the Open Software License (OSL 3.0) 00008 * that is bundled with this package in the file LICENSE.txt. 00009 * It is also available through the world-wide-web at this URL: 00010 * http://opensource.org/licenses/osl-3.0.php 00011 * If you did not receive a copy of the license and are unable to 00012 * obtain it through the world-wide-web, please send an email 00013 * to license@magentocommerce.com so we can send you a copy immediately. 00014 * 00015 * DISCLAIMER 00016 * 00017 * Do not edit or add to this file if you wish to upgrade Magento to newer 00018 * versions in the future. If you wish to customize Magento for your 00019 * needs please refer to http://www.magentocommerce.com for more information. 00020 * 00021 * @category Mage 00022 * @package Mage_Bundle 00023 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) 00024 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 00025 */ 00026 00027 /** 00028 * Bundle selection renderer 00029 * 00030 * @category Mage 00031 * @package Mage_Bundle 00032 * @author Magento Core Team <core@magentocommerce.com> 00033 */ 00034 class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection extends Mage_Adminhtml_Block_Widget 00035 { 00036 public function __construct() 00037 { 00038 $this->setTemplate('bundle/product/edit/bundle/option/selection.phtml'); 00039 } 00040 00041 public function getFieldId() 00042 { 00043 return 'bundle_selection'; 00044 } 00045 00046 public function getFieldName() 00047 { 00048 return 'bundle_selections'; 00049 } 00050 00051 protected function _prepareLayout() 00052 { 00053 $this->setChild('selection_delete_button', 00054 $this->getLayout()->createBlock('adminhtml/widget_button') 00055 ->setData(array( 00056 'label' => Mage::helper('catalog')->__('Delete'), 00057 'class' => 'delete icon-btn', 00058 'on_click' => 'bSelection.remove(event)' 00059 )) 00060 ); 00061 00062 return parent::_prepareLayout(); 00063 } 00064 00065 public function getSelectionDeleteButtonHtml() 00066 { 00067 return $this->getChildHtml('selection_delete_button'); 00068 } 00069 00070 public function getPriceTypeSelectHtml() 00071 { 00072 $select = $this->getLayout()->createBlock('adminhtml/html_select') 00073 ->setData(array( 00074 'id' => $this->getFieldId().'_{{index}}_price_type', 00075 'class' => 'select select-product-option-type required-option-select' 00076 )) 00077 ->setName($this->getFieldName().'[{{parentIndex}}][{{index}}][selection_price_type]') 00078 ->setOptions(Mage::getSingleton('bundle/source_option_selection_price_type')->toOptionArray()); 00079 00080 return $select->getHtml(); 00081 } 00082 00083 public function getQtyTypeSelectHtml() 00084 { 00085 $select = $this->getLayout()->createBlock('adminhtml/html_select') 00086 ->setData(array( 00087 'id' => $this->getFieldId().'_{{index}}_can_change_qty', 00088 'class' => 'select' 00089 )) 00090 ->setName($this->getFieldName().'[{{parentIndex}}][{{index}}][selection_can_change_qty]') 00091 ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray()); 00092 00093 return $select->getHtml(); 00094 } 00095 00096 public function getSelectionSearchUrl() 00097 { 00098 return $this->getUrl('bundle/selection/search'); 00099 } 00100 }