Mage_Adminhtml_Block_Report_Product_Lowstock_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Report_Product_Lowstock_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 ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()


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 38 of file Grid.php.

00039     {
00040         parent::__construct();
00041         $this->setId('gridLowstock');
00042         $this->setUseAjax(false);
00043     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 45 of file Grid.php.

00046     {
00047         if ($this->getRequest()->getParam('website')) {
00048             $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
00049             $storeId = array_pop($storeIds);
00050         } else if ($this->getRequest()->getParam('group')) {
00051             $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
00052             $storeId = array_pop($storeIds);
00053         } else if ($this->getRequest()->getParam('store')) {
00054             $storeId = (int)$this->getRequest()->getParam('store');
00055         } else {
00056             $storeId = '';
00057         }
00058 
00059         $collection = Mage::getModel('catalog/product')->getCollection()
00060             ->addAttributeToSelect('*')
00061             ->setStoreId($storeId)
00062             ->addAttributeToFilter('type_id', array(
00063                 Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
00064                 Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL
00065             ))
00066             ->joinField('qty',
00067                 'cataloginventory/stock_item',
00068                 'qty',
00069                 'product_id=entity_id',
00070                 '{{table}}.stock_id=1',
00071                 'left')
00072             ->setOrder('qty', 'asc');
00073 
00074         if( $storeId ) {
00075             $collection->addStoreFilter($storeId);
00076         }
00077 
00078         $this->setCollection($collection);
00079         return parent::_prepareCollection();
00080     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 82 of file Grid.php.

00083     {
00084         $this->addColumn('name', array(
00085             'header'    =>Mage::helper('reports')->__('Product Name'),
00086             'sortable'  =>false,
00087             'index'     =>'name'
00088         ));
00089 
00090         $this->addColumn('sku', array(
00091             'header'    =>Mage::helper('reports')->__('Product Sku'),
00092             'sortable'  =>false,
00093             'index'     =>'sku'
00094         ));
00095 
00096         $this->addColumn('qty', array(
00097             'header'    =>Mage::helper('reports')->__('Stock Qty'),
00098             'width'     =>'215px',
00099             'align'     =>'right',
00100             'sortable'  =>false,
00101             'filter'    =>'adminhtml/widget_grid_column_filter_range',
00102             'index'     =>'qty',
00103             'type'      =>'number'
00104         ));
00105 
00106         $this->addExportType('*/*/exportLowstockCsv', Mage::helper('reports')->__('CSV'));
00107         $this->addExportType('*/*/exportLowstockExcel', Mage::helper('reports')->__('Excel'));
00108 
00109         return parent::_prepareColumns();
00110     }


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

Generated on Sat Jul 4 17:22:55 2009 for Magento by  doxygen 1.5.8