1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27:
28: /**
29: * Report Sold Products Grid Block
30: *
31: * @category Mage
32: * @package Mage_Adminhtml
33: * @author Magento Core Team <core@magentocommerce.com>
34: */
35: class Mage_Adminhtml_Block_Report_Product_Sold_Grid extends Mage_Adminhtml_Block_Report_Grid
36: {
37: /**
38: * Sub report size
39: *
40: * @var int
41: */
42: protected $_subReportSize = 0;
43:
44: /**
45: * Initialize Grid settings
46: *
47: */
48: public function __construct()
49: {
50: parent::__construct();
51: $this->setId('gridProductsSold');
52: }
53:
54: /**
55: * Prepare collection object for grid
56: *
57: * @return Mage_Adminhtml_Block_Report_Product_Sold_Grid
58: */
59: protected function _prepareCollection()
60: {
61: parent::_prepareCollection();
62: $this->getCollection()
63: ->initReport('reports/product_sold_collection');
64: return $this;
65: }
66:
67: /**
68: * Prepare Grid columns
69: *
70: * @return Mage_Adminhtml_Block_Report_Product_Sold_Grid
71: */
72: protected function _prepareColumns()
73: {
74: $this->addColumn('name', array(
75: 'header' =>Mage::helper('reports')->__('Product Name'),
76: 'index' =>'order_items_name'
77: ));
78:
79: $this->addColumn('ordered_qty', array(
80: 'header' =>Mage::helper('reports')->__('Quantity Ordered'),
81: 'width' =>'120px',
82: 'align' =>'right',
83: 'index' =>'ordered_qty',
84: 'total' =>'sum',
85: 'type' =>'number'
86: ));
87:
88: $this->addExportType('*/*/exportSoldCsv', Mage::helper('reports')->__('CSV'));
89: $this->addExportType('*/*/exportSoldExcel', Mage::helper('reports')->__('Excel XML'));
90:
91: return parent::_prepareColumns();
92: }
93: }
94: