00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Report_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('productsReportGrid');
00041 $this->setDefaultSort('entity_id');
00042 $this->setDefaultDir('desc');
00043 }
00044
00045 protected function _prepareCollection()
00046 {
00047
00048 $collection = Mage::getResourceModel('reports/product_collection');
00049 $collection->getEntity()->setStore(0);
00050
00051 $this->setCollection($collection);
00052
00053 return parent::_prepareCollection();
00054 }
00055
00056 protected function _afterLoadCollection()
00057 {
00058 $totalObj = new Mage_Reports_Model_Totals();
00059 $this->setTotals($totalObj->countTotals($this));
00060 }
00061
00062 protected function _prepareColumns()
00063 {
00064 $this->addColumn('entity_id', array(
00065 'header' =>Mage::helper('reports')->__('ID'),
00066 'width' =>'50px',
00067 'index' =>'entity_id',
00068 'total' =>'Total'
00069 ));
00070
00071 $this->addColumn('name', array(
00072 'header' =>Mage::helper('reports')->__('Name'),
00073 'index' =>'name'
00074 ));
00075
00076 $this->addColumn('viewed', array(
00077 'header' =>Mage::helper('reports')->__('Number Viewed'),
00078 'width' =>'50px',
00079 'align' =>'right',
00080 'index' =>'viewed',
00081 'total' =>'sum'
00082 ));
00083
00084 $this->addColumn('added', array(
00085 'header' =>Mage::helper('reports')->__('Number Added'),
00086 'width' =>'50px',
00087 'align' =>'right',
00088 'index' =>'added',
00089 'total' =>'sum'
00090 ));
00091
00092 $this->addColumn('purchased', array(
00093 'header' =>Mage::helper('reports')->__('Number Purchased'),
00094 'width' =>'50px',
00095 'align' =>'right',
00096 'index' =>'purchased',
00097 'total' =>'sum'
00098 ));
00099
00100 $this->addColumn('fulfilled', array(
00101 'header' =>Mage::helper('reports')->__('Number Fulfilled'),
00102 'width' =>'50px',
00103 'align' =>'right',
00104 'index' =>'fulfilled',
00105 'total' =>'sum'
00106 ));
00107
00108 $this->addColumn('revenue', array(
00109 'header' =>Mage::helper('reports')->__('Revenue'),
00110 'width' =>'50px',
00111 'align' =>'right',
00112 'index' =>'revenue',
00113 'total' =>'sum'
00114 ));
00115
00116 $this->setCountTotals(true);
00117
00118 $this->addExportType('*/*/exportProductsCsv', Mage::helper('reports')->__('CSV'));
00119 $this->addExportType('*/*/exportProductsExcel', Mage::helper('reports')->__('Excel'));
00120
00121 return parent::_prepareColumns();
00122 }
00123
00124 }
00125