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_Shopcart_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('gridProducts');
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045 $collection = Mage::getResourceModel('reports/product_collection')
00046 ->addAttributeToSelect('name')
00047 ->addAttributeToSelect('price')
00048 ->setStoreId('')
00049 ->addCartsCount()
00050 ->addOrdersCount()
00051 ->setSelectCountSqlType(Mage_Reports_Model_Mysql4_Product_Collection::SELECT_COUNT_SQL_TYPE_CART);
00052
00053
00054 $this->setCollection($collection);
00055 return parent::_prepareCollection();
00056 }
00057
00058 protected function _prepareColumns()
00059 {
00060 $this->addColumn('entity_id', array(
00061 'header' =>Mage::helper('reports')->__('ID'),
00062 'width' =>'50px',
00063 'align' =>'right',
00064 'index' =>'entity_id'
00065 ));
00066
00067 $this->addColumn('name', array(
00068 'header' =>Mage::helper('reports')->__('Product Name'),
00069 'index' =>'name'
00070 ));
00071
00072 $this->addColumn('price', array(
00073 'header' =>Mage::helper('reports')->__('Price'),
00074 'width' =>'80px',
00075 'type' =>'currency',
00076 'currency_code' => $this->getCurrentCurrencyCode(),
00077 'index' =>'price',
00078 'renderer' =>'adminhtml/report_grid_column_renderer_currency'
00079 ));
00080
00081 $this->addColumn('carts', array(
00082 'header' =>Mage::helper('reports')->__('Carts'),
00083 'width' =>'80px',
00084 'align' =>'right',
00085 'index' =>'carts'
00086 ));
00087
00088 $this->addColumn('orders', array(
00089 'header' =>Mage::helper('reports')->__('Orders'),
00090 'width' =>'80px',
00091 'align' =>'right',
00092 'index' =>'orders'
00093 ));
00094
00095 $this->setFilterVisibility(false);
00096
00097 $this->addExportType('*/*/exportProductCsv', Mage::helper('reports')->__('CSV'));
00098 $this->addExportType('*/*/exportProductExcel', Mage::helper('reports')->__('Excel'));
00099
00100 return parent::_prepareColumns();
00101 }
00102
00103 }
00104