1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Report_Shopcart_Product_Grid extends Mage_Adminhtml_Block_Report_Grid_Shopcart
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('gridProducts');
41: }
42:
43: protected function _prepareCollection()
44: {
45:
46: $collection = Mage::getResourceModel('reports/quote_collection');
47: $collection->prepareForProductsInCarts()
48: ->setSelectCountSqlType(Mage_Reports_Model_Resource_Quote_Collection::SELECT_COUNT_SQL_TYPE_CART);
49: $this->setCollection($collection);
50: return parent::_prepareCollection();
51: }
52:
53: protected function _prepareColumns()
54: {
55: $this->addColumn('entity_id', array(
56: 'header' =>Mage::helper('reports')->__('ID'),
57: 'width' =>'50px',
58: 'align' =>'right',
59: 'index' =>'entity_id'
60: ));
61:
62: $this->addColumn('name', array(
63: 'header' =>Mage::helper('reports')->__('Product Name'),
64: 'index' =>'name'
65: ));
66:
67: $currencyCode = $this->getCurrentCurrencyCode();
68:
69: $this->addColumn('price', array(
70: 'header' =>Mage::helper('reports')->__('Price'),
71: 'width' =>'80px',
72: 'type' =>'currency',
73: 'currency_code' => $currencyCode,
74: 'index' =>'price',
75: 'renderer' =>'adminhtml/report_grid_column_renderer_currency',
76: 'rate' => $this->getRate($currencyCode),
77: ));
78:
79: $this->addColumn('carts', array(
80: 'header' =>Mage::helper('reports')->__('Carts'),
81: 'width' =>'80px',
82: 'align' =>'right',
83: 'index' =>'carts'
84: ));
85:
86: $this->addColumn('orders', array(
87: 'header' =>Mage::helper('reports')->__('Orders'),
88: 'width' =>'80px',
89: 'align' =>'right',
90: 'index' =>'orders'
91: ));
92:
93: $this->setFilterVisibility(false);
94:
95: $this->addExportType('*/*/exportProductCsv', Mage::helper('reports')->__('CSV'));
96: $this->addExportType('*/*/exportProductExcel', Mage::helper('reports')->__('Excel XML'));
97:
98: return parent::_prepareColumns();
99: }
100:
101: public function getRowUrl($row)
102: {
103: return $this->getUrl('*/catalog_product/edit', array('id'=>$row->getEntityId()));
104: }
105: }
106:
107: