MageWare_SalesGrids - Version 1.0.0.0

Version Notes

Public release-1.0.0.0

Download this release

Release Info

Developer MageWare
Extension MageWare_SalesGrids
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

Files changed (22) hide show
  1. app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Creditmemo/Grid.php +183 -0
  2. app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Invoice/Grid.php +182 -0
  3. app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Order/Grid.php +255 -0
  4. app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Shipment/Grid.php +164 -0
  5. app/code/community/MageWare/SalesGrids/Block/Adminhtml/Widget/Grid/Column/Renderer/List.php +15 -0
  6. app/code/community/MageWare/SalesGrids/Helper/Data.php +7 -0
  7. app/code/community/MageWare/SalesGrids/Model/Observer.php +108 -0
  8. app/code/community/MageWare/SalesGrids/Model/Resource/Order.php +14 -0
  9. app/code/community/MageWare/SalesGrids/Model/Resource/Order/Creditmemo.php +14 -0
  10. app/code/community/MageWare/SalesGrids/Model/Resource/Order/Invoice.php +14 -0
  11. app/code/community/MageWare/SalesGrids/Model/Resource/Order/Shipment.php +14 -0
  12. app/code/community/MageWare/SalesGrids/Model/Resource/Setup.php +7 -0
  13. app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Creditmemo/Grid.php +21 -0
  14. app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Invoice/Grid.php +21 -0
  15. app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Order/Grid.php +25 -0
  16. app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Shipment/Grid.php +20 -0
  17. app/code/community/MageWare/SalesGrids/data/salesgrids_setup/data-install-1.0.0.0.php +115 -0
  18. app/code/community/MageWare/SalesGrids/etc/config.xml +111 -0
  19. app/code/community/MageWare/SalesGrids/etc/system.xml +125 -0
  20. app/code/community/MageWare/SalesGrids/sql/salesgrids_setup/install-1.0.0.0.php +186 -0
  21. app/etc/modules/MageWare_SalesGrids.xml +12 -0
  22. package.xml +18 -0
app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Creditmemo/Grid.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Block_Adminhtml_Sales_Creditmemo_Grid
4
+ extends Mage_Adminhtml_Block_Sales_Creditmemo_Grid
5
+ {
6
+ const XML_PATH_ENABLED = 'admin/creditmemo/enabled';
7
+ const XML_PATH_COLUMNS = 'admin/creditmemo/columns';
8
+
9
+ protected function _prepareCollection()
10
+ {
11
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
12
+ return parent::_prepareCollection();
13
+ }
14
+
15
+ $collection = Mage::getResourceModel($this->_getCollectionClass())
16
+ ->addFieldToSelect('entity_id')
17
+ ->addFieldToSelect('base_currency_code')
18
+ ->addFieldToSelect('order_currency_code')
19
+ ;
20
+
21
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
22
+
23
+ if (in_array('increment_id', $columns)) {
24
+ $collection->addFieldToSelect('increment_id');
25
+ }
26
+
27
+ if (in_array('created_at', $columns)) {
28
+ $collection->addFieldToSelect('created_at');
29
+ }
30
+
31
+ if (in_array('order_increment_id', $columns)) {
32
+ $collection->addFieldToSelect('order_increment_id');
33
+ }
34
+
35
+ if (in_array('order_created_at', $columns)) {
36
+ $collection->addFieldToSelect('order_created_at');
37
+ }
38
+
39
+ if (in_array('billing_name', $columns)) {
40
+ $collection->addFieldToSelect('billing_name');
41
+ }
42
+
43
+ if (in_array('customer_email', $columns)) {
44
+ $collection->addFieldToSelect('customer_email');
45
+ }
46
+
47
+ if (in_array('product_sku', $columns)) {
48
+ $collection->addFieldToSelect('product_sku');
49
+ }
50
+
51
+ if (in_array('product_name', $columns)) {
52
+ $collection->addFieldToSelect('product_name');
53
+ }
54
+
55
+ if (in_array('state', $columns)) {
56
+ $collection->addFieldToSelect('state');
57
+ }
58
+
59
+ if (in_array('grand_total', $columns)) {
60
+ $collection->addFieldToSelect('grand_total');
61
+ }
62
+
63
+ $this->setCollection($collection);
64
+
65
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
66
+ }
67
+
68
+ protected function _prepareColumns()
69
+ {
70
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
71
+ return parent::_prepareColumns();
72
+ }
73
+
74
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
75
+
76
+ if (in_array('increment_id', $columns)) {
77
+ $this->addColumn('increment_id', array(
78
+ 'header' => Mage::helper('sales')->__('Credit Memo #'),
79
+ 'index' => 'increment_id',
80
+ 'type' => 'text',
81
+ ));
82
+ }
83
+
84
+ if (in_array('created_at', $columns)) {
85
+ $this->addColumn('created_at', array(
86
+ 'header' => Mage::helper('sales')->__('Created At'),
87
+ 'index' => 'created_at',
88
+ 'type' => 'datetime',
89
+ ));
90
+ }
91
+
92
+ if (in_array('order_increment_id', $columns)) {
93
+ $this->addColumn('order_increment_id', array(
94
+ 'header' => Mage::helper('sales')->__('Order #'),
95
+ 'index' => 'order_increment_id',
96
+ 'type' => 'text',
97
+ ));
98
+ }
99
+
100
+ if (in_array('order_created_at', $columns)) {
101
+ $this->addColumn('order_created_at', array(
102
+ 'header' => Mage::helper('sales')->__('Order Date'),
103
+ 'index' => 'order_created_at',
104
+ 'type' => 'datetime',
105
+ ));
106
+ }
107
+
108
+ if (in_array('billing_name', $columns)) {
109
+ $this->addColumn('billing_name', array(
110
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
111
+ 'index' => 'billing_name',
112
+ ));
113
+ }
114
+
115
+ if (in_array('customer_email', $columns)) {
116
+ $this->addColumn('customer_email', array(
117
+ 'header' => Mage::helper('customer')->__('Email'),
118
+ 'index' => 'customer_email',
119
+ ));
120
+ }
121
+
122
+ if (in_array('product_sku', $columns)) {
123
+ $this->addColumn('product_sku', array(
124
+ 'header' => Mage::helper('catalog')->__('SKU'),
125
+ 'index' => 'product_sku',
126
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
127
+ ));
128
+ }
129
+
130
+ if (in_array('product_name', $columns)) {
131
+ $this->addColumn('product_name', array(
132
+ 'header' => Mage::helper('catalog')->__('Product'),
133
+ 'index' => 'product_name',
134
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
135
+ ));
136
+ }
137
+
138
+ if (in_array('state', $columns)) {
139
+ $this->addColumn('state', array(
140
+ 'header' => Mage::helper('sales')->__('Status'),
141
+ 'index' => 'state',
142
+ 'type' => 'options',
143
+ 'options' => Mage::getModel('sales/order_creditmemo')->getStates(),
144
+ ));
145
+ }
146
+
147
+ if (in_array('grand_total', $columns)) {
148
+ $this->addColumn('grand_total', array(
149
+ 'header' => Mage::helper('customer')->__('Refunded'),
150
+ 'index' => 'grand_total',
151
+ 'type' => 'currency',
152
+ 'align' => 'right',
153
+ 'currency' => 'order_currency_code',
154
+ ));
155
+ }
156
+
157
+ if (in_array('action', $columns)) {
158
+ $this->addColumn('action',
159
+ array(
160
+ 'header' => Mage::helper('sales')->__('Action'),
161
+ 'width' => '50px',
162
+ 'type' => 'action',
163
+ 'getter' => 'getId',
164
+ 'actions' => array(
165
+ array(
166
+ 'caption' => Mage::helper('sales')->__('View'),
167
+ 'url' => array('base'=>'*/sales_creditmemo/view'),
168
+ 'field' => 'creditmemo_id'
169
+ )
170
+ ),
171
+ 'filter' => false,
172
+ 'sortable' => false,
173
+ 'is_system' => true
174
+ ));
175
+ }
176
+
177
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
178
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
179
+
180
+
181
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
182
+ }
183
+ }
app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Invoice/Grid.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Block_Adminhtml_Sales_Invoice_Grid
4
+ extends Mage_Adminhtml_Block_Sales_Invoice_Grid
5
+ {
6
+ const XML_PATH_ENABLED = 'admin/invoice/enabled';
7
+ const XML_PATH_COLUMNS = 'admin/invoice/columns';
8
+
9
+ protected function _prepareCollection()
10
+ {
11
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
12
+ return parent::_prepareCollection();
13
+ }
14
+
15
+ $collection = Mage::getResourceModel($this->_getCollectionClass())
16
+ ->addFieldToSelect('entity_id')
17
+ ->addFieldToSelect('base_currency_code')
18
+ ->addFieldToSelect('order_currency_code')
19
+ ;
20
+
21
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
22
+
23
+ if (in_array('increment_id', $columns)) {
24
+ $collection->addFieldToSelect('increment_id');
25
+ }
26
+
27
+ if (in_array('created_at', $columns)) {
28
+ $collection->addFieldToSelect('created_at');
29
+ }
30
+
31
+ if (in_array('order_increment_id', $columns)) {
32
+ $collection->addFieldToSelect('order_increment_id');
33
+ }
34
+
35
+ if (in_array('order_created_at', $columns)) {
36
+ $collection->addFieldToSelect('order_created_at');
37
+ }
38
+
39
+ if (in_array('billing_name', $columns)) {
40
+ $collection->addFieldToSelect('billing_name');
41
+ }
42
+
43
+ if (in_array('customer_email', $columns)) {
44
+ $collection->addFieldToSelect('customer_email');
45
+ }
46
+
47
+ if (in_array('product_sku', $columns)) {
48
+ $collection->addFieldToSelect('product_sku');
49
+ }
50
+
51
+ if (in_array('product_name', $columns)) {
52
+ $collection->addFieldToSelect('product_name');
53
+ }
54
+
55
+ if (in_array('state', $columns)) {
56
+ $collection->addFieldToSelect('state');
57
+ }
58
+
59
+ if (in_array('grand_total', $columns)) {
60
+ $collection->addFieldToSelect('grand_total');
61
+ }
62
+
63
+ $this->setCollection($collection);
64
+
65
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
66
+ }
67
+
68
+ protected function _prepareColumns()
69
+ {
70
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
71
+ return parent::_prepareColumns();
72
+ }
73
+
74
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
75
+
76
+ if (in_array('increment_id', $columns)) {
77
+ $this->addColumn('increment_id', array(
78
+ 'header' => Mage::helper('sales')->__('Invoice #'),
79
+ 'index' => 'increment_id',
80
+ 'type' => 'text',
81
+ ));
82
+ }
83
+
84
+ if (in_array('created_at', $columns)) {
85
+ $this->addColumn('created_at', array(
86
+ 'header' => Mage::helper('sales')->__('Invoice Date'),
87
+ 'index' => 'created_at',
88
+ 'type' => 'datetime',
89
+ ));
90
+ }
91
+
92
+ if (in_array('order_increment_id', $columns)) {
93
+ $this->addColumn('order_increment_id', array(
94
+ 'header' => Mage::helper('sales')->__('Order #'),
95
+ 'index' => 'order_increment_id',
96
+ 'type' => 'text',
97
+ ));
98
+ }
99
+
100
+ if (in_array('order_created_at', $columns)) {
101
+ $this->addColumn('order_created_at', array(
102
+ 'header' => Mage::helper('sales')->__('Order Date'),
103
+ 'index' => 'order_created_at',
104
+ 'type' => 'datetime',
105
+ ));
106
+ }
107
+
108
+ if (in_array('billing_name', $columns)) {
109
+ $this->addColumn('billing_name', array(
110
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
111
+ 'index' => 'billing_name',
112
+ ));
113
+ }
114
+
115
+ if (in_array('customer_email', $columns)) {
116
+ $this->addColumn('customer_email', array(
117
+ 'header' => Mage::helper('customer')->__('Email'),
118
+ 'index' => 'customer_email',
119
+ ));
120
+ }
121
+
122
+ if (in_array('product_sku', $columns)) {
123
+ $this->addColumn('product_sku', array(
124
+ 'header' => Mage::helper('catalog')->__('SKU'),
125
+ 'index' => 'product_sku',
126
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
127
+ ));
128
+ }
129
+
130
+ if (in_array('product_name', $columns)) {
131
+ $this->addColumn('product_name', array(
132
+ 'header' => Mage::helper('catalog')->__('Product'),
133
+ 'index' => 'product_name',
134
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
135
+ ));
136
+ }
137
+
138
+ if (in_array('state', $columns)) {
139
+ $this->addColumn('state', array(
140
+ 'header' => Mage::helper('sales')->__('Status'),
141
+ 'index' => 'state',
142
+ 'type' => 'options',
143
+ 'options' => Mage::getModel('sales/order_invoice')->getStates(),
144
+ ));
145
+ }
146
+
147
+ if (in_array('grand_total', $columns)) {
148
+ $this->addColumn('grand_total', array(
149
+ 'header' => Mage::helper('customer')->__('Amount'),
150
+ 'index' => 'grand_total',
151
+ 'type' => 'currency',
152
+ 'align' => 'right',
153
+ 'currency' => 'order_currency_code',
154
+ ));
155
+ }
156
+
157
+ if (in_array('action', $columns)) {
158
+ $this->addColumn('action',
159
+ array(
160
+ 'header' => Mage::helper('sales')->__('Action'),
161
+ 'width' => '50px',
162
+ 'type' => 'action',
163
+ 'getter' => 'getId',
164
+ 'actions' => array(
165
+ array(
166
+ 'caption' => Mage::helper('sales')->__('View'),
167
+ 'url' => array('base'=>'*/sales_invoice/view'),
168
+ 'field' => 'invoice_id'
169
+ )
170
+ ),
171
+ 'filter' => false,
172
+ 'sortable' => false,
173
+ 'is_system' => true
174
+ ));
175
+ }
176
+
177
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
178
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
179
+
180
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
181
+ }
182
+ }
app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Block_Adminhtml_Sales_Order_Grid
4
+ extends Mage_Adminhtml_Block_Sales_Order_Grid
5
+ {
6
+ const XML_PATH_ENABLED = 'admin/order/enabled';
7
+ const XML_PATH_COLUMNS = 'admin/order/columns';
8
+
9
+ protected function _prepareCollection()
10
+ {
11
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
12
+ return parent::_prepareCollection();
13
+ }
14
+
15
+ $collection = Mage::getResourceModel($this->_getCollectionClass())
16
+ ->addFieldToSelect('entity_id')
17
+ ->addFieldToSelect('base_currency_code')
18
+ ->addFieldToSelect('order_currency_code')
19
+ ;
20
+
21
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
22
+
23
+ if (in_array('increment_id', $columns)) {
24
+ $collection->addFieldToSelect('increment_id');
25
+ }
26
+
27
+ if (in_array('store_id', $columns)) {
28
+ if (!Mage::app()->isSingleStoreMode()) {
29
+ $collection->addFieldToSelect('store_id');
30
+ }
31
+ }
32
+
33
+ if (in_array('created_at', $columns)) {
34
+ $collection->addFieldToSelect('created_at');
35
+ }
36
+
37
+ if (in_array('billing_name', $columns)) {
38
+ $collection->addFieldToSelect('billing_name');
39
+ }
40
+
41
+ if (in_array('shipping_name', $columns)) {
42
+ $collection->addFieldToSelect('shipping_name');
43
+ }
44
+
45
+ if (in_array('customer_email', $columns)) {
46
+ $collection->addFieldToSelect('customer_email');
47
+ }
48
+
49
+ if (in_array('customer_is_guest', $columns)) {
50
+ $collection->addFieldToSelect('customer_is_guest');
51
+ }
52
+
53
+ if (in_array('customer_group_id', $columns)) {
54
+ $collection->addFieldToSelect('customer_group_id');
55
+ }
56
+
57
+ if (in_array('product_sku', $columns)) {
58
+ $collection->addFieldToSelect('product_sku');
59
+ }
60
+
61
+ if (in_array('product_name', $columns)) {
62
+ $collection->addFieldToSelect('product_name');
63
+ }
64
+
65
+ if (in_array('payment_method', $columns)) {
66
+ $collection->addFieldToSelect('payment_method');
67
+ }
68
+
69
+ if (in_array('base_grand_total', $columns)) {
70
+ $collection->addFieldToSelect('base_grand_total');
71
+ }
72
+
73
+ if (in_array('grand_total', $columns)) {
74
+ $collection->addFieldToSelect('grand_total');
75
+ }
76
+
77
+ if (in_array('status', $columns)) {
78
+ $collection->addFieldToSelect('status');
79
+ }
80
+
81
+ $this->setCollection($collection);
82
+
83
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
84
+ }
85
+
86
+ protected function _prepareColumns()
87
+ {
88
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
89
+ return parent::_prepareColumns();
90
+ }
91
+
92
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
93
+
94
+ if (in_array('increment_id', $columns)) {
95
+ $this->addColumn('real_order_id', array(
96
+ 'header'=> Mage::helper('sales')->__('Order #'),
97
+ 'width' => '80px',
98
+ 'type' => 'text',
99
+ 'index' => 'increment_id',
100
+ ));
101
+ }
102
+
103
+ if (in_array('store_id', $columns)) {
104
+ if (!Mage::app()->isSingleStoreMode()) {
105
+ $this->addColumn('store_id', array(
106
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
107
+ 'index' => 'store_id',
108
+ 'type' => 'store',
109
+ 'store_view' => true,
110
+ 'display_deleted' => true,
111
+ ));
112
+ }
113
+ }
114
+
115
+ if (in_array('created_at', $columns)) {
116
+ $this->addColumn('created_at', array(
117
+ 'header' => Mage::helper('sales')->__('Purchased On'),
118
+ 'index' => 'created_at',
119
+ 'type' => 'datetime',
120
+ 'width' => '100px',
121
+ ));
122
+ }
123
+
124
+ if (in_array('billing_name', $columns)) {
125
+ $this->addColumn('billing_name', array(
126
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
127
+ 'index' => 'billing_name',
128
+ ));
129
+ }
130
+
131
+ if (in_array('shipping_name', $columns)) {
132
+ $this->addColumn('shipping_name', array(
133
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
134
+ 'index' => 'shipping_name',
135
+ ));
136
+ }
137
+
138
+ if (in_array('customer_email', $columns)) {
139
+ $this->addColumn('customer_email', array(
140
+ 'header' => Mage::helper('customer')->__('Email'),
141
+ 'index' => 'customer_email',
142
+ ));
143
+ }
144
+
145
+ if (in_array('customer_is_guest', $columns)) {
146
+ $this->addColumn('customer_is_guest', array(
147
+ 'header' => Mage::helper('customer')->__('Guest'),
148
+ 'index' => 'customer_is_guest',
149
+ 'type' => 'options',
150
+ 'options' => array(
151
+ 0 => Mage::helper('adminhtml')->__('No'),
152
+ 1 => Mage::helper('adminhtml')->__('Yes')
153
+ )
154
+ ));
155
+ }
156
+
157
+ if (in_array('customer_group_id', $columns)) {
158
+ $groups = Mage::getResourceModel('customer/group_collection')
159
+ ->addFieldToFilter('customer_group_id', array('gt' => 0))
160
+ ->load()
161
+ ->toOptionHash();
162
+
163
+ $this->addColumn('customer_group_id', array(
164
+ 'header' => Mage::helper('customer')->__('Customer Group'),
165
+ 'width' => '100px',
166
+ 'index' => 'customer_group_id',
167
+ 'type' => 'options',
168
+ 'options' => $groups,
169
+ ));
170
+ }
171
+
172
+ if (in_array('product_sku', $columns)) {
173
+ $this->addColumn('product_sku', array(
174
+ 'header' => Mage::helper('catalog')->__('SKU'),
175
+ 'index' => 'product_sku',
176
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
177
+ ));
178
+ }
179
+
180
+ if (in_array('product_name', $columns)) {
181
+ $this->addColumn('product_name', array(
182
+ 'header' => Mage::helper('catalog')->__('Product'),
183
+ 'index' => 'product_name',
184
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
185
+ ));
186
+ }
187
+
188
+ if (in_array('payment_method', $columns)) {
189
+ $this->addColumn('payment_method', array(
190
+ 'header' => Mage::helper('payment')->__('Payment Method'),
191
+ 'index' => 'payment_method',
192
+ 'type' => 'options',
193
+ 'options' => Mage::helper('payment')->getPaymentMethodList()
194
+ ));
195
+ }
196
+
197
+ if (in_array('base_grand_total', $columns)) {
198
+ $this->addColumn('base_grand_total', array(
199
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
200
+ 'index' => 'base_grand_total',
201
+ 'type' => 'currency',
202
+ 'currency' => 'base_currency_code',
203
+ ));
204
+ }
205
+
206
+ if (in_array('grand_total', $columns)) {
207
+ $this->addColumn('grand_total', array(
208
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
209
+ 'index' => 'grand_total',
210
+ 'type' => 'currency',
211
+ 'currency' => 'order_currency_code',
212
+ ));
213
+ }
214
+
215
+ if (in_array('status', $columns)) {
216
+ $this->addColumn('status', array(
217
+ 'header' => Mage::helper('sales')->__('Status'),
218
+ 'index' => 'status',
219
+ 'type' => 'options',
220
+ 'width' => '70px',
221
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
222
+ ));
223
+ }
224
+
225
+ if (in_array('action', $columns)) {
226
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
227
+ $this->addColumn('action',
228
+ array(
229
+ 'header' => Mage::helper('sales')->__('Action'),
230
+ 'width' => '50px',
231
+ 'type' => 'action',
232
+ 'getter' => 'getId',
233
+ 'actions' => array(
234
+ array(
235
+ 'caption' => Mage::helper('sales')->__('View'),
236
+ 'url' => array('base'=>'*/sales_order/view'),
237
+ 'field' => 'order_id'
238
+ )
239
+ ),
240
+ 'filter' => false,
241
+ 'sortable' => false,
242
+ 'index' => 'stores',
243
+ 'is_system' => true,
244
+ ));
245
+ }
246
+ }
247
+
248
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
249
+
250
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
251
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
252
+
253
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
254
+ }
255
+ }
app/code/community/MageWare/SalesGrids/Block/Adminhtml/Sales/Shipment/Grid.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Block_Adminhtml_Sales_Shipment_Grid
4
+ extends Mage_Adminhtml_Block_Sales_Shipment_Grid
5
+ {
6
+ const XML_PATH_ENABLED = 'admin/shipment/enabled';
7
+ const XML_PATH_COLUMNS = 'admin/shipment/columns';
8
+
9
+ protected function _prepareCollection()
10
+ {
11
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
12
+ return parent::_prepareCollection();
13
+ }
14
+
15
+ $collection = Mage::getResourceModel($this->_getCollectionClass())
16
+ ->addFieldToSelect('entity_id');
17
+
18
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
19
+
20
+ if (in_array('increment_id', $columns)) {
21
+ $collection->addFieldToSelect('increment_id');
22
+ }
23
+
24
+ if (in_array('created_at', $columns)) {
25
+ $collection->addFieldToSelect('created_at');
26
+ }
27
+
28
+ if (in_array('order_increment_id', $columns)) {
29
+ $collection->addFieldToSelect('order_increment_id');
30
+ }
31
+
32
+ if (in_array('order_created_at', $columns)) {
33
+ $collection->addFieldToSelect('order_created_at');
34
+ }
35
+
36
+ if (in_array('shipping_name', $columns)) {
37
+ $collection->addFieldToSelect('shipping_name');
38
+ }
39
+
40
+ if (in_array('customer_email', $columns)) {
41
+ $collection->addFieldToSelect('customer_email');
42
+ }
43
+
44
+ if (in_array('product_sku', $columns)) {
45
+ $collection->addFieldToSelect('product_sku');
46
+ }
47
+
48
+ if (in_array('product_name', $columns)) {
49
+ $collection->addFieldToSelect('product_name');
50
+ }
51
+
52
+ if (in_array('total_qty', $columns)) {
53
+ $collection->addFieldToSelect('total_qty');
54
+ }
55
+
56
+ $this->setCollection($collection);
57
+
58
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
59
+ }
60
+
61
+ protected function _prepareColumns()
62
+ {
63
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
64
+ return parent::_prepareColumns();
65
+ }
66
+
67
+ $columns = explode(',', Mage::getStoreConfig(self::XML_PATH_COLUMNS));
68
+
69
+ if (in_array('increment_id', $columns)) {
70
+ $this->addColumn('increment_id', array(
71
+ 'header' => Mage::helper('sales')->__('Shipment #'),
72
+ 'index' => 'increment_id',
73
+ 'type' => 'text',
74
+ ));
75
+ }
76
+
77
+ if (in_array('created_at', $columns)) {
78
+ $this->addColumn('created_at', array(
79
+ 'header' => Mage::helper('sales')->__('Date Shipped'),
80
+ 'index' => 'created_at',
81
+ 'type' => 'datetime',
82
+ ));
83
+ }
84
+
85
+ if (in_array('order_increment_id', $columns)) {
86
+ $this->addColumn('order_increment_id', array(
87
+ 'header' => Mage::helper('sales')->__('Order #'),
88
+ 'index' => 'order_increment_id',
89
+ 'type' => 'text',
90
+ ));
91
+ }
92
+
93
+ if (in_array('order_created_at', $columns)) {
94
+ $this->addColumn('order_created_at', array(
95
+ 'header' => Mage::helper('sales')->__('Order Date'),
96
+ 'index' => 'order_created_at',
97
+ 'type' => 'datetime',
98
+ ));
99
+ }
100
+
101
+ if (in_array('shipping_name', $columns)) {
102
+ $this->addColumn('shipping_name', array(
103
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
104
+ 'index' => 'shipping_name',
105
+ ));
106
+ }
107
+
108
+ if (in_array('customer_email', $columns)) {
109
+ $this->addColumn('customer_email', array(
110
+ 'header' => Mage::helper('customer')->__('Email'),
111
+ 'index' => 'customer_email',
112
+ ));
113
+ }
114
+
115
+ if (in_array('product_sku', $columns)) {
116
+ $this->addColumn('product_sku', array(
117
+ 'header' => Mage::helper('catalog')->__('SKU'),
118
+ 'index' => 'product_sku',
119
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
120
+ ));
121
+ }
122
+
123
+ if (in_array('product_name', $columns)) {
124
+ $this->addColumn('product_name', array(
125
+ 'header' => Mage::helper('catalog')->__('Product'),
126
+ 'index' => 'product_name',
127
+ 'renderer' => 'salesgrids/adminhtml_widget_grid_column_renderer_list'
128
+ ));
129
+ }
130
+
131
+ if (in_array('total_qty', $columns)) {
132
+ $this->addColumn('total_qty', array(
133
+ 'header' => Mage::helper('sales')->__('Total Qty'),
134
+ 'index' => 'total_qty',
135
+ 'type' => 'number',
136
+ ));
137
+ }
138
+
139
+ if (in_array('action', $columns)) {
140
+ $this->addColumn('action',
141
+ array(
142
+ 'header' => Mage::helper('sales')->__('Action'),
143
+ 'width' => '50px',
144
+ 'type' => 'action',
145
+ 'getter' => 'getId',
146
+ 'actions' => array(
147
+ array(
148
+ 'caption' => Mage::helper('sales')->__('View'),
149
+ 'url' => array('base'=>'*/sales_shipment/view'),
150
+ 'field' => 'shipment_id'
151
+ )
152
+ ),
153
+ 'filter' => false,
154
+ 'sortable' => false,
155
+ 'is_system' => true
156
+ ));
157
+ }
158
+
159
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
160
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
161
+
162
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
163
+ }
164
+ }
app/code/community/MageWare/SalesGrids/Block/Adminhtml/Widget/Grid/Column/Renderer/List.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Block_Adminhtml_Widget_Grid_Column_Renderer_List
4
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
5
+ {
6
+ public function render(Varien_Object $row)
7
+ {
8
+ return nl2br($this->escapeHtml(parent::_getValue($row)));
9
+ }
10
+
11
+ public function renderExport(Varien_Object $row)
12
+ {
13
+ return str_replace("\n", ' ', parent::_getValue($row));
14
+ }
15
+ }
app/code/community/MageWare/SalesGrids/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Helper_Data
4
+ extends Mage_Core_Helper_Abstract
5
+ {
6
+
7
+ }
app/code/community/MageWare/SalesGrids/Model/Observer.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Observer
4
+ {
5
+ public function initOrderGridColumns($observer)
6
+ {
7
+ $resource = $observer->getEvent()->getResource();
8
+
9
+ $resource->addVirtualGridColumn(
10
+ 'product_sku',
11
+ 'sales/order_item',
12
+ array('entity_id' => 'order_id'),
13
+ 'GROUP_CONCAT(DISTINCT {{table}}.sku ORDER BY {{table}}.sku ASC SEPARATOR "\n")'
14
+ );
15
+
16
+ $resource->addVirtualGridColumn(
17
+ 'product_name',
18
+ 'sales/order_item',
19
+ array('entity_id' => 'order_id'),
20
+ 'GROUP_CONCAT(DISTINCT {{table}}.name ORDER BY {{table}}.name ASC SEPARATOR "\n")'
21
+ );
22
+
23
+ $resource->addVirtualGridColumn(
24
+ 'payment_method',
25
+ 'sales/order_payment',
26
+ array('entity_id' => 'parent_id'),
27
+ '{{table}}.method'
28
+ );
29
+ }
30
+
31
+ public function initOrderInvoiceGridColumns($observer)
32
+ {
33
+ $resource = $observer->getEvent()->getResource();
34
+
35
+ $resource->addVirtualGridColumn(
36
+ 'customer_email',
37
+ 'sales/order',
38
+ array('order_id' => 'entity_id'),
39
+ '{{table}}.customer_email'
40
+ );
41
+
42
+ $resource->addVirtualGridColumn(
43
+ 'product_sku',
44
+ 'sales/invoice_item',
45
+ array('entity_id' => 'parent_id'),
46
+ 'GROUP_CONCAT(DISTINCT {{table}}.sku ORDER BY {{table}}.sku ASC SEPARATOR "\n")'
47
+ );
48
+
49
+ $resource->addVirtualGridColumn(
50
+ 'product_name',
51
+ 'sales/invoice_item',
52
+ array('entity_id' => 'parent_id'),
53
+ 'GROUP_CONCAT(DISTINCT {{table}}.name ORDER BY {{table}}.name ASC SEPARATOR "\n")'
54
+ );
55
+ }
56
+
57
+ public function initOrderShipmentGridColumns($observer)
58
+ {
59
+ $resource = $observer->getEvent()->getResource();
60
+
61
+ $resource->addVirtualGridColumn(
62
+ 'customer_email',
63
+ 'sales/order',
64
+ array('order_id' => 'entity_id'),
65
+ '{{table}}.customer_email'
66
+ );
67
+
68
+ $resource->addVirtualGridColumn(
69
+ 'product_sku',
70
+ 'sales/shipment_item',
71
+ array('entity_id' => 'parent_id'),
72
+ 'GROUP_CONCAT(DISTINCT {{table}}.sku ORDER BY {{table}}.sku ASC SEPARATOR "\n")'
73
+ );
74
+
75
+ $resource->addVirtualGridColumn(
76
+ 'product_name',
77
+ 'sales/shipment_item',
78
+ array('entity_id' => 'parent_id'),
79
+ 'GROUP_CONCAT(DISTINCT {{table}}.name ORDER BY {{table}}.name ASC SEPARATOR "\n")'
80
+ );
81
+ }
82
+
83
+ public function initOrderCreditmemoGridColumns($observer)
84
+ {
85
+ $resource = $observer->getEvent()->getResource();
86
+
87
+ $resource->addVirtualGridColumn(
88
+ 'customer_email',
89
+ 'sales/order',
90
+ array('order_id' => 'entity_id'),
91
+ '{{table}}.customer_email'
92
+ );
93
+
94
+ $resource->addVirtualGridColumn(
95
+ 'product_sku',
96
+ 'sales/creditmemo_item',
97
+ array('entity_id' => 'parent_id'),
98
+ 'GROUP_CONCAT(DISTINCT {{table}}.sku ORDER BY {{table}}.sku ASC SEPARATOR "\n")'
99
+ );
100
+
101
+ $resource->addVirtualGridColumn(
102
+ 'product_name',
103
+ 'sales/creditmemo_item',
104
+ array('entity_id' => 'parent_id'),
105
+ 'GROUP_CONCAT(DISTINCT {{table}}.name ORDER BY {{table}}.name ASC SEPARATOR "\n")'
106
+ );
107
+ }
108
+ }
app/code/community/MageWare/SalesGrids/Model/Resource/Order.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Resource_Order
4
+ extends Mage_Sales_Model_Resource_Order
5
+ {
6
+ public function getUpdateGridRecordsSelect($ids, &$flatColumnsToSelect, $gridColumns = null)
7
+ {
8
+ $select = parent::getUpdateGridRecordsSelect($ids, $flatColumnsToSelect, $gridColumns);
9
+
10
+ $select->group('main_table.' . $this->getIdFieldName());
11
+
12
+ return $select;
13
+ }
14
+ }
app/code/community/MageWare/SalesGrids/Model/Resource/Order/Creditmemo.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Resource_Order_Creditmemo
4
+ extends Mage_Sales_Model_Resource_Order_Creditmemo
5
+ {
6
+ public function getUpdateGridRecordsSelect($ids, &$flatColumnsToSelect, $gridColumns = null)
7
+ {
8
+ $select = parent::getUpdateGridRecordsSelect($ids, $flatColumnsToSelect, $gridColumns);
9
+
10
+ $select->group('main_table.' . $this->getIdFieldName());
11
+
12
+ return $select;
13
+ }
14
+ }
app/code/community/MageWare/SalesGrids/Model/Resource/Order/Invoice.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Resource_Order_Invoice
4
+ extends Mage_Sales_Model_Resource_Order_Invoice
5
+ {
6
+ public function getUpdateGridRecordsSelect($ids, &$flatColumnsToSelect, $gridColumns = null)
7
+ {
8
+ $select = parent::getUpdateGridRecordsSelect($ids, $flatColumnsToSelect, $gridColumns);
9
+
10
+ $select->group('main_table.' . $this->getIdFieldName());
11
+
12
+ return $select;
13
+ }
14
+ }
app/code/community/MageWare/SalesGrids/Model/Resource/Order/Shipment.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Resource_Order_Shipment
4
+ extends Mage_Sales_Model_Resource_Order_Shipment
5
+ {
6
+ public function getUpdateGridRecordsSelect($ids, &$flatColumnsToSelect, $gridColumns = null)
7
+ {
8
+ $select = parent::getUpdateGridRecordsSelect($ids, $flatColumnsToSelect, $gridColumns);
9
+
10
+ $select->group('main_table.' . $this->getIdFieldName());
11
+
12
+ return $select;
13
+ }
14
+ }
app/code/community/MageWare/SalesGrids/Model/Resource/Setup.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_Resource_Setup
4
+ extends Mage_Core_Model_Resource_Setup
5
+ {
6
+
7
+ }
app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Creditmemo/Grid.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_System_Config_Source_Creditmemo_Grid
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'increment_id', 'label' => Mage::helper('sales')->__('Credit Memo #')),
9
+ array('value' => 'created_at', 'label' => Mage::helper('sales')->__('Created At')),
10
+ array('value' => 'order_increment_id', 'label' => Mage::helper('sales')->__('Order #')),
11
+ array('value' => 'order_created_at', 'label' => Mage::helper('sales')->__('Order Date')),
12
+ array('value' => 'billing_name', 'label' => Mage::helper('sales')->__('Bill to Name')),
13
+ array('value' => 'customer_email', 'label' => Mage::helper('customer')->__('Email')),
14
+ array('value' => 'product_sku', 'label' => Mage::helper('catalog')->__('SKU')),
15
+ array('value' => 'product_name', 'label' => Mage::helper('catalog')->__('Product')),
16
+ array('value' => 'state', 'label' => Mage::helper('sales')->__('Status')),
17
+ array('value' => 'grand_total', 'label' => Mage::helper('sales')->__('Refunded')),
18
+ array('value' => 'action', 'label' => Mage::helper('sales')->__('Action')),
19
+ );
20
+ }
21
+ }
app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Invoice/Grid.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_System_Config_Source_Invoice_Grid
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'increment_id', 'label' => Mage::helper('sales')->__('Invoice #')),
9
+ array('value' => 'created_at', 'label' => Mage::helper('sales')->__('Invoice Date')),
10
+ array('value' => 'order_increment_id', 'label' => Mage::helper('sales')->__('Order #')),
11
+ array('value' => 'order_created_at', 'label' => Mage::helper('sales')->__('Order Date')),
12
+ array('value' => 'billing_name', 'label' => Mage::helper('sales')->__('Bill to Name')),
13
+ array('value' => 'customer_email', 'label' => Mage::helper('customer')->__('Email')),
14
+ array('value' => 'product_sku', 'label' => Mage::helper('catalog')->__('SKU')),
15
+ array('value' => 'product_name', 'label' => Mage::helper('catalog')->__('Product')),
16
+ array('value' => 'state', 'label' => Mage::helper('sales')->__('Status')),
17
+ array('value' => 'grand_total', 'label' => Mage::helper('customer')->__('Amount')),
18
+ array('value' => 'action', 'label' => Mage::helper('sales')->__('Action')),
19
+ );
20
+ }
21
+ }
app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Order/Grid.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_System_Config_Source_Order_Grid
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'increment_id', 'label' => Mage::helper('sales')->__('Order #')),
9
+ array('value' => 'store_id', 'label' => Mage::helper('sales')->__('Purchased From (Store)')),
10
+ array('value' => 'created_at', 'label' => Mage::helper('sales')->__('Purchased On')),
11
+ array('value' => 'billing_name', 'label' => Mage::helper('sales')->__('Bill to Name')),
12
+ array('value' => 'shipping_name', 'label' => Mage::helper('sales')->__('Ship to Name')),
13
+ array('value' => 'customer_email', 'label' => Mage::helper('customer')->__('Email')),
14
+ array('value' => 'customer_is_guest', 'label' => Mage::helper('customer')->__('Guest')),
15
+ array('value' => 'customer_group_id', 'label' => Mage::helper('customer')->__('Customer Group')),
16
+ array('value' => 'product_sku', 'label' => Mage::helper('catalog')->__('SKU')),
17
+ array('value' => 'product_name', 'label' => Mage::helper('catalog')->__('Product')),
18
+ array('value' => 'payment_method', 'label' => Mage::helper('payment')->__('Payment Method')),
19
+ array('value' => 'base_grand_total', 'label' => Mage::helper('sales')->__('G.T. (Base)')),
20
+ array('value' => 'grand_total', 'label' => Mage::helper('sales')->__('G.T. (Purchased)')),
21
+ array('value' => 'status', 'label' => Mage::helper('sales')->__('Status')),
22
+ array('value' => 'action', 'label' => Mage::helper('sales')->__('Action')),
23
+ );
24
+ }
25
+ }
app/code/community/MageWare/SalesGrids/Model/System/Config/Source/Shipment/Grid.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MageWare_SalesGrids_Model_System_Config_Source_Shipment_Grid
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 'increment_id', 'label' => Mage::helper('sales')->__('Shipment #')),
9
+ array('value' => 'created_at', 'label' => Mage::helper('sales')->__('Date Shipped')),
10
+ array('value' => 'order_increment_id', 'label' => Mage::helper('sales')->__('Order #')),
11
+ array('value' => 'order_created_at', 'label' => Mage::helper('sales')->__('Order Date')),
12
+ array('value' => 'shipping_name', 'label' => Mage::helper('sales')->__('Ship to Name')),
13
+ array('value' => 'customer_email', 'label' => Mage::helper('customer')->__('Email')),
14
+ array('value' => 'product_sku', 'label' => Mage::helper('catalog')->__('SKU')),
15
+ array('value' => 'product_name', 'label' => Mage::helper('catalog')->__('Product')),
16
+ array('value' => 'total_qty', 'label' => Mage::helper('sales')->__('Total Qty')),
17
+ array('value' => 'action', 'label' => Mage::helper('sales')->__('Action')),
18
+ );
19
+ }
20
+ }
app/code/community/MageWare/SalesGrids/data/salesgrids_setup/data-install-1.0.0.0.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $flatColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/order')));
6
+ $gridColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/order_grid')));
7
+
8
+ $flatColumnsToSelect = array_intersect($flatColumns, $gridColumns);
9
+
10
+ $select = $installer->getConnection()->select()
11
+ ->from($installer->getTable('sales/order'), $flatColumnsToSelect)
12
+ ->joinLeft(
13
+ $installer->getTable('sales/order_payment'),
14
+ $installer->getTable('sales/order').'.entity_id='.$installer->getTable('sales/order_payment').'.parent_id',
15
+ array('payment_method' => $installer->getTable('sales/order_payment').'.method')
16
+ )
17
+ ->joinLeft(
18
+ $installer->getTable('sales/order_item'),
19
+ $installer->getTable('sales/order').'.entity_id='.$installer->getTable('sales/order_item').'.order_id',
20
+ array(
21
+ 'product_sku' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/order_item').'.sku ORDER BY '.$installer->getTable('sales/order_item').'.sku ASC SEPARATOR "\n")'),
22
+ 'product_name' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/order_item').'.name ORDER BY '.$installer->getTable('sales/order_item').'.name ASC SEPARATOR "\n")')
23
+ )
24
+ )
25
+ ->group($installer->getTable('sales/order').'.entity_id');
26
+
27
+ $flatColumnsToSelect[] = 'payment_method';
28
+ $flatColumnsToSelect[] = 'product_sku';
29
+ $flatColumnsToSelect[] = 'product_name';
30
+
31
+ $installer->getConnection()->query($select->insertFromSelect($installer->getTable('sales/order_grid'), $flatColumnsToSelect, true));
32
+
33
+ $flatColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/invoice')));
34
+ $gridColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/invoice_grid')));
35
+
36
+ $flatColumnsToSelect = array_intersect($flatColumns, $gridColumns);
37
+
38
+ $select = $installer->getConnection()->select()
39
+ ->from($installer->getTable('sales/invoice'), $flatColumnsToSelect)
40
+ ->joinLeft(
41
+ $installer->getTable('sales/order'),
42
+ $installer->getTable('sales/invoice').'.order_id='.$installer->getTable('sales/order').'.entity_id',
43
+ array('customer_email' => $installer->getTable('sales/order').'.customer_email')
44
+ )
45
+ ->joinLeft(
46
+ $installer->getTable('sales/invoice_item'),
47
+ $installer->getTable('sales/invoice').'.entity_id='.$installer->getTable('sales/invoice_item').'.parent_id',
48
+ array(
49
+ 'product_sku' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/invoice_item').'.sku ORDER BY '.$installer->getTable('sales/invoice_item').'.sku ASC SEPARATOR "\n")'),
50
+ 'product_name' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/invoice_item').'.name ORDER BY '.$installer->getTable('sales/invoice_item').'.name ASC SEPARATOR "\n")')
51
+ )
52
+ )
53
+ ->group($installer->getTable('sales/invoice').'.entity_id');
54
+
55
+ $flatColumnsToSelect[] = 'customer_email';
56
+ $flatColumnsToSelect[] = 'product_sku';
57
+ $flatColumnsToSelect[] = 'product_name';
58
+
59
+ $installer->getConnection()->query($select->insertFromSelect($installer->getTable('sales/invoice_grid'), $flatColumnsToSelect, true));
60
+
61
+ $flatColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/shipment')));
62
+ $gridColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/shipment_grid')));
63
+
64
+ $flatColumnsToSelect = array_intersect($flatColumns, $gridColumns);
65
+
66
+ $select = $installer->getConnection()->select()
67
+ ->from($installer->getTable('sales/shipment'), $flatColumnsToSelect)
68
+ ->joinLeft(
69
+ $installer->getTable('sales/order'),
70
+ $installer->getTable('sales/shipment').'.order_id='.$installer->getTable('sales/order').'.entity_id',
71
+ array('customer_email' => $installer->getTable('sales/order').'.customer_email')
72
+ )
73
+ ->joinLeft(
74
+ $installer->getTable('sales/shipment_item'),
75
+ $installer->getTable('sales/shipment').'.entity_id='.$installer->getTable('sales/shipment_item').'.parent_id',
76
+ array(
77
+ 'product_sku' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/shipment_item').'.sku ORDER BY '.$installer->getTable('sales/shipment_item').'.sku ASC SEPARATOR "\n")'),
78
+ 'product_name' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/shipment_item').'.name ORDER BY '.$installer->getTable('sales/shipment_item').'.name ASC SEPARATOR "\n")')
79
+ )
80
+ )
81
+ ->group($installer->getTable('sales/shipment').'.entity_id');
82
+
83
+ $flatColumnsToSelect[] = 'customer_email';
84
+ $flatColumnsToSelect[] = 'product_sku';
85
+ $flatColumnsToSelect[] = 'product_name';
86
+
87
+ $installer->getConnection()->query($select->insertFromSelect($installer->getTable('sales/shipment_grid'), $flatColumnsToSelect, true));
88
+
89
+ $flatColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/creditmemo')));
90
+ $gridColumns = array_keys($installer->getConnection()->describeTable($installer->getTable('sales/creditmemo_grid')));
91
+
92
+ $flatColumnsToSelect = array_intersect($flatColumns, $gridColumns);
93
+
94
+ $select = $installer->getConnection()->select()
95
+ ->from($installer->getTable('sales/creditmemo'), $flatColumnsToSelect)
96
+ ->joinLeft(
97
+ $installer->getTable('sales/order'),
98
+ $installer->getTable('sales/creditmemo').'.order_id='.$installer->getTable('sales/order').'.entity_id',
99
+ array('customer_email' => $installer->getTable('sales/order').'.customer_email')
100
+ )
101
+ ->joinLeft(
102
+ $installer->getTable('sales/creditmemo_item'),
103
+ $installer->getTable('sales/creditmemo').'.entity_id='.$installer->getTable('sales/creditmemo_item').'.parent_id',
104
+ array(
105
+ 'product_sku' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/creditmemo_item').'.sku ORDER BY '.$installer->getTable('sales/creditmemo_item').'.sku ASC SEPARATOR "\n")'),
106
+ 'product_name' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT '.$installer->getTable('sales/creditmemo_item').'.name ORDER BY '.$installer->getTable('sales/creditmemo_item').'.name ASC SEPARATOR "\n")')
107
+ )
108
+ )
109
+ ->group($installer->getTable('sales/creditmemo').'.entity_id');
110
+
111
+ $flatColumnsToSelect[] = 'customer_email';
112
+ $flatColumnsToSelect[] = 'product_sku';
113
+ $flatColumnsToSelect[] = 'product_name';
114
+
115
+ $installer->getConnection()->query($select->insertFromSelect($installer->getTable('sales/creditmemo_grid'), $flatColumnsToSelect, true));
app/code/community/MageWare/SalesGrids/etc/config.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MageWare_SalesGrids>
5
+ <version>1.0.0.0</version>
6
+ </MageWare_SalesGrids>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <salesgrids>
11
+ <class>MageWare_SalesGrids_Model</class>
12
+ <resourceModel>salesgrids_resource</resourceModel>
13
+ </salesgrids>
14
+ <salesgrids_resource>
15
+ <class>MageWare_SalesGrids_Model_Resource</class>
16
+ </salesgrids_resource>
17
+ <sales_resource>
18
+ <rewrite>
19
+ <order>MageWare_SalesGrids_Model_Resource_Order</order>
20
+ <order_invoice>MageWare_SalesGrids_Model_Resource_Order_Invoice</order_invoice>
21
+ <order_shipment>MageWare_SalesGrids_Model_Resource_Order_Shipment</order_shipment>
22
+ <order_creditmemo>MageWare_SalesGrids_Model_Resource_Order_Creditmemo</order_creditmemo>
23
+ </rewrite>
24
+ </sales_resource>
25
+ </models>
26
+ <resources>
27
+ <salesgrids_setup>
28
+ <setup>
29
+ <module>MageWare_SalesGrids</module>
30
+ <class>MageWare_SalesGrids_Model_Resource_Setup</class>
31
+ </setup>
32
+ </salesgrids_setup>
33
+ </resources>
34
+ <blocks>
35
+ <salesgrids>
36
+ <class>MageWare_SalesGrids_Block</class>
37
+ </salesgrids>
38
+ <adminhtml>
39
+ <rewrite>
40
+ <sales_order_grid>MageWare_SalesGrids_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
41
+ <sales_invoice_grid>MageWare_SalesGrids_Block_Adminhtml_Sales_Invoice_Grid</sales_invoice_grid>
42
+ <sales_shipment_grid>MageWare_SalesGrids_Block_Adminhtml_Sales_Shipment_Grid</sales_shipment_grid>
43
+ <sales_creditmemo_grid>MageWare_SalesGrids_Block_Adminhtml_Sales_Creditmemo_Grid</sales_creditmemo_grid>
44
+ </rewrite>
45
+ </adminhtml>
46
+ </blocks>
47
+ <helpers>
48
+ <salesgrids>
49
+ <class>MageWare_SalesGrids_Helper</class>
50
+ </salesgrids>
51
+ </helpers>
52
+ <events>
53
+ <sales_order_resource_init_virtual_grid_columns>
54
+ <observers>
55
+ <salesgrids_order_init_virtual_grid_columns>
56
+ <class>salesgrids/observer</class>
57
+ <type>singleton</type>
58
+ <method>initOrderGridColumns</method>
59
+ </salesgrids_order_init_virtual_grid_columns>
60
+ </observers>
61
+ </sales_order_resource_init_virtual_grid_columns>
62
+ <sales_order_invoice_resource_init_virtual_grid_columns>
63
+ <observers>
64
+ <salesgrids_order_invoice_init_virtual_grid_columns>
65
+ <class>salesgrids/observer</class>
66
+ <type>singleton</type>
67
+ <method>initOrderInvoiceGridColumns</method>
68
+ </salesgrids_order_invoice_init_virtual_grid_columns>
69
+ </observers>
70
+ </sales_order_invoice_resource_init_virtual_grid_columns>
71
+ <sales_order_shipment_resource_init_virtual_grid_columns>
72
+ <observers>
73
+ <salesgrids_order_shipment_init_virtual_grid_columns>
74
+ <class>salesgrids/observer</class>
75
+ <type>singleton</type>
76
+ <method>initOrderShipmentGridColumns</method>
77
+ </salesgrids_order_shipment_init_virtual_grid_columns>
78
+ </observers>
79
+ </sales_order_shipment_resource_init_virtual_grid_columns>
80
+ <sales_order_creditmemo_resource_init_virtual_grid_columns>
81
+ <observers>
82
+ <salesgrids_order_creditmemo_init_virtual_grid_columns>
83
+ <class>salesgrids/observer</class>
84
+ <type>singleton</type>
85
+ <method>initOrderCreditmemoGridColumns</method>
86
+ </salesgrids_order_creditmemo_init_virtual_grid_columns>
87
+ </observers>
88
+ </sales_order_creditmemo_resource_init_virtual_grid_columns>
89
+ </events>
90
+ </global>
91
+ <default>
92
+ <admin>
93
+ <order>
94
+ <enabled>0</enabled>
95
+ <columns>increment_id,store_id,created_at,billing_name,shipping_name,base_grand_total,grand_total,status,action</columns>
96
+ </order>
97
+ <invoice>
98
+ <enabled>0</enabled>
99
+ <columns>increment_id,created_at,order_increment_id,order_created_at,billing_name,state,grand_total,action</columns>
100
+ </invoice>
101
+ <shipment>
102
+ <enabled>0</enabled>
103
+ <columns>increment_id,created_at,order_increment_id,order_created_at,shipping_name,total_qty,action</columns>
104
+ </shipment>
105
+ <creditmemo>
106
+ <enabled>0</enabled>
107
+ <columns>increment_id,created_at,order_increment_id,order_created_at,billing_name,state,grand_total,action</columns>
108
+ </creditmemo>
109
+ </admin>
110
+ </default>
111
+ </config>
app/code/community/MageWare/SalesGrids/etc/system.xml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <admin>
5
+ <groups>
6
+ <order translate="label">
7
+ <label>Orders</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>100</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>0</show_in_website>
12
+ <show_in_store>0</show_in_store>
13
+ <fields>
14
+ <enabled translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>0</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </enabled>
23
+ <columns translate="label">
24
+ <label>Select</label>
25
+ <frontend_type>multiselect</frontend_type>
26
+ <source_model>salesgrids/system_config_source_order_grid</source_model>
27
+ <sort_order>20</sort_order>
28
+ <depends><enabled>1</enabled></depends>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>0</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </columns>
33
+ </fields>
34
+ </order>
35
+ <invoice translate="label">
36
+ <label>Invoices</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>110</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>0</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ <fields>
43
+ <enabled translate="label">
44
+ <label>Enabled</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>10</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>0</show_in_website>
50
+ <show_in_store>0</show_in_store>
51
+ </enabled>
52
+ <columns translate="label">
53
+ <label>Select</label>
54
+ <frontend_type>multiselect</frontend_type>
55
+ <source_model>salesgrids/system_config_source_invoice_grid</source_model>
56
+ <sort_order>20</sort_order>
57
+ <depends><enabled>1</enabled></depends>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>0</show_in_website>
60
+ <show_in_store>0</show_in_store>
61
+ </columns>
62
+ </fields>
63
+ </invoice>
64
+ <shipment translate="label">
65
+ <label>Shipments</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>120</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>0</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ <fields>
72
+ <enabled translate="label">
73
+ <label>Enabled</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>10</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>0</show_in_website>
79
+ <show_in_store>0</show_in_store>
80
+ </enabled>
81
+ <columns translate="label">
82
+ <label>Select</label>
83
+ <frontend_type>multiselect</frontend_type>
84
+ <source_model>salesgrids/system_config_source_shipment_grid</source_model>
85
+ <sort_order>20</sort_order>
86
+ <depends><enabled>1</enabled></depends>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>0</show_in_website>
89
+ <show_in_store>0</show_in_store>
90
+ </columns>
91
+ </fields>
92
+ </shipment>
93
+ <creditmemo translate="label">
94
+ <label>Credit Memos</label>
95
+ <frontend_type>text</frontend_type>
96
+ <sort_order>130</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>0</show_in_website>
99
+ <show_in_store>0</show_in_store>
100
+ <fields>
101
+ <enabled translate="label">
102
+ <label>Enabled</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_yesno</source_model>
105
+ <sort_order>10</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>0</show_in_website>
108
+ <show_in_store>0</show_in_store>
109
+ </enabled>
110
+ <columns translate="label">
111
+ <label>Select</label>
112
+ <frontend_type>multiselect</frontend_type>
113
+ <source_model>salesgrids/system_config_source_creditmemo_grid</source_model>
114
+ <sort_order>20</sort_order>
115
+ <depends><enabled>1</enabled></depends>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>0</show_in_website>
118
+ <show_in_store>0</show_in_store>
119
+ </columns>
120
+ </fields>
121
+ </creditmemo>
122
+ </groups>
123
+ </admin>
124
+ </sections>
125
+ </config>
app/code/community/MageWare/SalesGrids/sql/salesgrids_setup/install-1.0.0.0.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->getConnection()
8
+ ->addColumn($installer->getTable('sales/order_grid'), 'customer_email', array(
9
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
10
+ 'comment' => 'Customer Email',
11
+ 'length' => '255'
12
+ ));
13
+
14
+ $installer->getConnection()
15
+ ->addColumn($installer->getTable('sales/order_grid'), 'customer_is_guest', array(
16
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
17
+ 'comment' => 'Customer Is Guest',
18
+ 'unsigned' => true
19
+ ));
20
+
21
+ $installer->getConnection()
22
+ ->addColumn($installer->getTable('sales/order_grid'), 'customer_group_id', array(
23
+ 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
24
+ 'comment' => 'Customer Group Id'
25
+ ));
26
+
27
+ $installer->getConnection()
28
+ ->addColumn($installer->getTable('sales/order_grid'), 'product_sku', array(
29
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
30
+ 'comment' => 'Product Sku',
31
+ 'length' => '255'
32
+ ));
33
+
34
+ $installer->getConnection()
35
+ ->addColumn($installer->getTable('sales/order_grid'), 'product_name', array(
36
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
37
+ 'comment' => 'Product Name',
38
+ 'length' => '255'
39
+ ));
40
+
41
+ $installer->getConnection()
42
+ ->addColumn($installer->getTable('sales/order_grid'), 'payment_method', array(
43
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
44
+ 'comment' => 'Payment Method',
45
+ 'length' => '255'
46
+ ));
47
+
48
+ $installer->getConnection()
49
+ ->addIndex($installer->getTable('sales/order_grid'),
50
+ $installer->getIdxName('sales/order_grid', array('customer_email')),
51
+ array('customer_email'));
52
+
53
+ $installer->getConnection()
54
+ ->addIndex($installer->getTable('sales/order_grid'),
55
+ $installer->getIdxName('sales/order_grid', array('customer_is_guest')),
56
+ array('customer_is_guest'));
57
+
58
+ $installer->getConnection()
59
+ ->addIndex($installer->getTable('sales/order_grid'),
60
+ $installer->getIdxName('sales/order_grid', array('customer_group_id')),
61
+ array('customer_group_id'));
62
+
63
+ $installer->getConnection()
64
+ ->addIndex($installer->getTable('sales/order_grid'),
65
+ $installer->getIdxName('sales/order_grid', array('product_sku')),
66
+ array('product_sku'));
67
+
68
+ $installer->getConnection()
69
+ ->addIndex($installer->getTable('sales/order_grid'),
70
+ $installer->getIdxName('sales/order_grid', array('product_name')),
71
+ array('product_name'));
72
+
73
+ $installer->getConnection()
74
+ ->addIndex($installer->getTable('sales/order_grid'),
75
+ $installer->getIdxName('sales/order_grid', array('payment_method')),
76
+ array('payment_method'));
77
+
78
+ $installer->getConnection()
79
+ ->addColumn($installer->getTable('sales/invoice_grid'), 'customer_email', array(
80
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
81
+ 'comment' => 'Customer Email',
82
+ 'length' => '255'
83
+ ));
84
+
85
+ $installer->getConnection()
86
+ ->addColumn($installer->getTable('sales/invoice_grid'), 'product_sku', array(
87
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
88
+ 'comment' => 'Product Sku',
89
+ 'length' => '255'
90
+ ));
91
+
92
+ $installer->getConnection()
93
+ ->addColumn($installer->getTable('sales/invoice_grid'), 'product_name', array(
94
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
95
+ 'comment' => 'Product Name',
96
+ 'length' => '255'
97
+ ));
98
+
99
+ $installer->getConnection()
100
+ ->addIndex($installer->getTable('sales/invoice_grid'),
101
+ $installer->getIdxName('sales/invoice_grid', array('customer_email')),
102
+ array('customer_email'));
103
+
104
+ $installer->getConnection()
105
+ ->addIndex($installer->getTable('sales/invoice_grid'),
106
+ $installer->getIdxName('sales/invoice_grid', array('product_sku')),
107
+ array('product_sku'));
108
+
109
+ $installer->getConnection()
110
+ ->addIndex($installer->getTable('sales/invoice_grid'),
111
+ $installer->getIdxName('sales/invoice_grid', array('product_name')),
112
+ array('product_name'));
113
+
114
+ $installer->getConnection()
115
+ ->addColumn($installer->getTable('sales/shipment_grid'), 'customer_email', array(
116
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
117
+ 'comment' => 'Customer Email',
118
+ 'length' => '255'
119
+ ));
120
+
121
+ $installer->getConnection()
122
+ ->addColumn($installer->getTable('sales/shipment_grid'), 'product_sku', array(
123
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
124
+ 'comment' => 'Product Sku',
125
+ 'length' => '255'
126
+ ));
127
+
128
+ $installer->getConnection()
129
+ ->addColumn($installer->getTable('sales/shipment_grid'), 'product_name', array(
130
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
131
+ 'comment' => 'Product Name',
132
+ 'length' => '255'
133
+ ));
134
+
135
+ $installer->getConnection()
136
+ ->addIndex($installer->getTable('sales/shipment_grid'),
137
+ $installer->getIdxName('sales/shipment_grid', array('customer_email')),
138
+ array('customer_email'));
139
+
140
+ $installer->getConnection()
141
+ ->addIndex($installer->getTable('sales/shipment_grid'),
142
+ $installer->getIdxName('sales/shipment_grid', array('product_sku')),
143
+ array('product_sku'));
144
+
145
+ $installer->getConnection()
146
+ ->addIndex($installer->getTable('sales/shipment_grid'),
147
+ $installer->getIdxName('sales/shipment_grid', array('product_name')),
148
+ array('product_name'));
149
+
150
+ $installer->getConnection()
151
+ ->addColumn($installer->getTable('sales/creditmemo_grid'), 'customer_email', array(
152
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
153
+ 'comment' => 'Customer Email',
154
+ 'length' => '255'
155
+ ));
156
+
157
+ $installer->getConnection()
158
+ ->addColumn($installer->getTable('sales/creditmemo_grid'), 'product_sku', array(
159
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
160
+ 'comment' => 'Product Sku',
161
+ 'length' => '255'
162
+ ));
163
+
164
+ $installer->getConnection()
165
+ ->addColumn($installer->getTable('sales/creditmemo_grid'), 'product_name', array(
166
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
167
+ 'comment' => 'Product Name',
168
+ 'length' => '255'
169
+ ));
170
+
171
+ $installer->getConnection()
172
+ ->addIndex($installer->getTable('sales/creditmemo_grid'),
173
+ $installer->getIdxName('sales/creditmemo_grid', array('customer_email')),
174
+ array('customer_email'));
175
+
176
+ $installer->getConnection()
177
+ ->addIndex($installer->getTable('sales/creditmemo_grid'),
178
+ $installer->getIdxName('sales/creditmemo_grid', array('product_sku')),
179
+ array('product_sku'));
180
+
181
+ $installer->getConnection()
182
+ ->addIndex($installer->getTable('sales/creditmemo_grid'),
183
+ $installer->getIdxName('sales/creditmemo_grid', array('product_name')),
184
+ array('product_name'));
185
+
186
+ $installer->endSetup();
app/etc/modules/MageWare_SalesGrids.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MageWare_SalesGrids>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Sales />
9
+ </depends>
10
+ </MageWare_SalesGrids>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MageWare_SalesGrids</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Module for extending order management grids.</summary>
10
+ <description>Makes order management much easier and efficient for store administrators.</description>
11
+ <notes>Public release-1.0.0.0</notes>
12
+ <authors><author><name>MageWare</name><user>mageware</user><email>magentocommerce@mageware.co</email></author></authors>
13
+ <date>2013-02-24</date>
14
+ <time>11:17:55</time>
15
+ <contents><target name="magecommunity"><dir name="MageWare"><dir name="SalesGrids"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Creditmemo"><file name="Grid.php" hash="eafc15a3c8ce1822beea8421b6a38b05"/></dir><dir name="Invoice"><file name="Grid.php" hash="797a7cdf943d0b08886518204ced5b16"/></dir><dir name="Order"><file name="Grid.php" hash="044c3746aaab806e792ec51509ea9146"/></dir><dir name="Shipment"><file name="Grid.php" hash="da16bda01942010040311a1a0e3010af"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="List.php" hash="bc8b3a99b39aa84ad00c68757a8d9580"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="cd4559adf776e0d4aee51bf47d3e5eb8"/></dir><dir name="Model"><file name="Observer.php" hash="188f637cabb0c57657b5cdafbe2b844d"/><dir name="Resource"><dir name="Order"><file name="Creditmemo.php" hash="ef4b836af182f1fa00265ebc6aff44fa"/><file name="Invoice.php" hash="e0bb8a5c3f72ed01f2b163a6105b3c93"/><file name="Shipment.php" hash="18b85f5880895898ce168eabb11af96b"/></dir><file name="Order.php" hash="de4fdc47e8309bd336e53a3d91ac82bf"/><file name="Setup.php" hash="829694a93aac3d84469cb87e03474890"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Creditmemo"><file name="Grid.php" hash="2d0ae403da508fc6d8a86440fc0c2231"/></dir><dir name="Invoice"><file name="Grid.php" hash="5d722b0ca1abd5bb6247cc168b5ffd11"/></dir><dir name="Order"><file name="Grid.php" hash="e2b30ce23e8e13e2a59305ecfa308239"/></dir><dir name="Shipment"><file name="Grid.php" hash="158c9d8393a28f99f6237d3d5d27849a"/></dir></dir></dir></dir></dir><dir name="data"><dir name="salesgrids_setup"><file name="data-install-1.0.0.0.php" hash="85ca289d4607b3a0d973487e13a77960"/></dir></dir><dir name="etc"><file name="config.xml" hash="908d004fb9fc0e5c5d8911db1d57f7e2"/><file name="system.xml" hash="1c61ebd9fec05d94c0605fc76b9ee327"/></dir><dir name="sql"><dir name="salesgrids_setup"><file name="install-1.0.0.0.php" hash="c441ab893d892da2f00ae4a6b7263c3c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MageWare_SalesGrids.xml" hash="a724485b1aee066050a7ba125cd70504"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_All_Latest</name><channel>community</channel><min>1.6.0.0</min><max>1.7.0.2</max></package></required></dependencies>
18
+ </package>