Public Member Functions | |
__construct () | |
Protected Member Functions | |
_prepareCollection () | |
_prepareColumns () |
Definition at line 34 of file Grid.php.
__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 36 of file Grid.php.
00037 { 00038 parent::__construct(); 00039 $this->setId('downloadsGrid'); 00040 $this->setUseAjax(false); 00041 }
_prepareCollection | ( | ) | [protected] |
Prepare grid collection object
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 43 of file Grid.php.
00044 { 00045 if ($this->getRequest()->getParam('website')) { 00046 $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); 00047 $storeId = array_pop($storeIds); 00048 } else if ($this->getRequest()->getParam('group')) { 00049 $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); 00050 $storeId = array_pop($storeIds); 00051 } else if ($this->getRequest()->getParam('store')) { 00052 $storeId = (int)$this->getRequest()->getParam('store'); 00053 } else { 00054 $storeId = ''; 00055 } 00056 00057 $collection = Mage::getResourceModel('reports/product_downloads_collection') 00058 ->addAttributeToSelect('*') 00059 ->setStoreId($storeId) 00060 ->addAttributeToFilter('type_id', array(Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE)) 00061 ->addSummary(); 00062 00063 if( $storeId ) { 00064 $collection->addStoreFilter($storeId); 00065 } 00066 00067 $this->setCollection($collection); 00068 return parent::_prepareCollection(); 00069 }
_prepareColumns | ( | ) | [protected] |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 71 of file Grid.php.
00072 { 00073 $this->addColumn('name', array( 00074 'header' => Mage::helper('reports')->__('Product Name'), 00075 'index' => 'name' 00076 )); 00077 00078 $this->addColumn('link_title', array( 00079 'header' => Mage::helper('reports')->__('Link'), 00080 'index' => 'link_title' 00081 )); 00082 00083 $this->addColumn('sku', array( 00084 'header' =>Mage::helper('reports')->__('Product Sku'), 00085 'index' =>'sku' 00086 )); 00087 00088 $this->addColumn('purchases', array( 00089 'header' => Mage::helper('reports')->__('Purchases'), 00090 'width' => '215px', 00091 'align' => 'right', 00092 'filter' => false, 00093 'index' => 'purchases', 00094 'type' => 'number', 00095 'renderer' => 'adminhtml/report_product_downloads_renderer_purchases', 00096 )); 00097 00098 $this->addColumn('downloads', array( 00099 'header' => Mage::helper('reports')->__('Downloads'), 00100 'width' => '215px', 00101 'align' => 'right', 00102 'filter' => false, 00103 'index' => 'downloads', 00104 'type' => 'number' 00105 )); 00106 00107 $this->addExportType('*/*/exportDownloadsCsv', Mage::helper('reports')->__('CSV')); 00108 $this->addExportType('*/*/exportDownloadsExcel', Mage::helper('reports')->__('Excel')); 00109 00110 return parent::_prepareColumns(); 00111 }