Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid Class Reference

Inheritance diagram for Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search_Grid:

Mage_Adminhtml_Block_Widget_Grid 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 ()
 getGridUrl ()
 getStore ()
 getAllowedSelectionTypes ()

Protected Member Functions

 _beforeToHtml ()
 _prepareCollection ()
 _prepareColumns ()
 _getSelectedProducts ()
 _getProducts ()


Detailed Description

Definition at line 34 of file Grid.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 37 of file Grid.php.

00038     {
00039         parent::__construct();
00040         $this->setId('bundle_selection_search_grid');
00041         $this->setRowClickCallback('bSelection.productGridRowClick.bind(bSelection)');
00042         $this->setCheckboxCheckCallback('bSelection.productGridCheckboxCheck.bind(bSelection)');
00043         $this->setRowInitCallback('bSelection.productGridRowInit.bind(bSelection)');
00044         $this->setDefaultSort('id');
00045         $this->setUseAjax(true);
00046     }


Member Function Documentation

_beforeToHtml (  )  [protected]

Before rendering html, but after trying to load cache

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 48 of file Grid.php.

00049     {
00050         $this->setId($this->getId().'_'.$this->getIndex());
00051         $this->getChild('reset_filter_button')->setData('onclick', $this->getJsObjectName().'.resetFilter()');
00052         $this->getChild('search_button')->setData('onclick', $this->getJsObjectName().'.doFilter()');
00053 
00054         return parent::_beforeToHtml();
00055     }

_getProducts (  )  [protected]

Definition at line 164 of file Grid.php.

00165     {
00166         if ($products = $this->getRequest()->getPost('products', null)) {
00167             return $products;
00168         } else if ($productss = $this->getRequest()->getParam('productss', null)) {
00169             return explode(',', $productss);
00170         } else {
00171             return array();
00172         }
00173     }

_getSelectedProducts (  )  [protected]

Definition at line 158 of file Grid.php.

00159     {
00160         $products = $this->getRequest()->getPost('selected_products', array());
00161         return $products;
00162     }

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 57 of file Grid.php.

00058     {
00059         $collection = Mage::getModel('catalog/product')->getCollection()
00060             ->setStore($this->getStore())
00061             ->addAttributeToSelect('name')
00062             ->addAttributeToSelect('sku')
00063             ->addAttributeToSelect('price')
00064             ->addAttributeToSelect('attribute_set_id')
00065             ->addAttributeToFilter('type_id', array('in' => $this->getAllowedSelectionTypes()))
00066             ->addFilterByRequiredOptions()
00067             ->addStoreFilter();
00068 
00069         if ($products = $this->_getProducts()) {
00070             $collection->addIdFilter($this->_getProducts(), true);
00071         }
00072 
00073         if ($this->getFirstShow()) {
00074             $collection->addIdFilter('-1');
00075             $this->setEmptyText($this->__('Please enter search conditions to view products.'));
00076         }
00077 
00078         Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($collection);
00079 
00080         $this->setCollection($collection);
00081 
00082         return parent::_prepareCollection();
00083     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 85 of file Grid.php.

00086     {
00087         $this->addColumn('id', array(
00088             'header'    => Mage::helper('sales')->__('ID'),
00089             'sortable'  => true,
00090             'width'     => '60px',
00091             'index'     => 'entity_id'
00092         ));
00093         $this->addColumn('name', array(
00094             'header'    => Mage::helper('sales')->__('Product Name'),
00095             'index'     => 'name',
00096             'column_css_class'=> 'name'
00097         ));
00098 
00099         $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
00100             ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
00101             ->load()
00102             ->toOptionHash();
00103 
00104         $this->addColumn('set_name',
00105             array(
00106                 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
00107                 'width' => '100px',
00108                 'index' => 'attribute_set_id',
00109                 'type'  => 'options',
00110                 'options' => $sets,
00111         ));
00112 
00113         $this->addColumn('sku', array(
00114             'header'    => Mage::helper('sales')->__('SKU'),
00115             'width'     => '80px',
00116             'index'     => 'sku',
00117             'column_css_class'=> 'sku'
00118         ));
00119         $this->addColumn('price', array(
00120             'header'    => Mage::helper('sales')->__('Price'),
00121             'align'     => 'center',
00122             'type'      => 'currency',
00123             'currency_code' => $this->getStore()->getCurrentCurrencyCode(),
00124             'rate'      => $this->getStore()->getBaseCurrency()->getRate($this->getStore()->getCurrentCurrencyCode()),
00125             'index'     => 'price'
00126         ));
00127 
00128         $this->addColumn('is_selected', array(
00129             'header_css_class' => 'a-center',
00130             'type'      => 'checkbox',
00131             'name'      => 'in_selected',
00132             'align'     => 'center',
00133             'values'    => $this->_getSelectedProducts(),
00134             'index'     => 'entity_id',
00135         ));
00136 
00137         $this->addColumn('qty', array(
00138             'filter'    => false,
00139             'sortable'  => false,
00140             'header'    => Mage::helper('sales')->__('Qty To Add'),
00141             'name'      => 'qty',
00142             'inline_css'=> 'qty',
00143             'align'     => 'right',
00144             'type'      => 'input',
00145             'validate_class' => 'validate-number',
00146             'index'     => 'qty',
00147             'width'     => '130px',
00148         ));
00149 
00150         return parent::_prepareColumns();
00151     }

getAllowedSelectionTypes (  ) 

Definition at line 180 of file Grid.php.

00181     {
00182         $config = Mage::getConfig()->getNode('global/catalog/product/type/bundle')->asArray();
00183         return array_keys($config['allowed_selection_types']);
00184     }

getGridUrl (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 153 of file Grid.php.

00154     {
00155         return $this->getUrl('bundle/selection/grid', array('index' => $this->getIndex(), 'productss' => implode(',', $this->_getProducts())));
00156     }

getStore (  ) 

Definition at line 175 of file Grid.php.

00176     {
00177         return Mage::app()->getStore();
00178     }


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