Noble_Extended_Order_Grid - Version 1.0.0

Version Notes

Tested only with Magento Community 1.7

Download this release

Release Info

Developer Gilles Lesire
Extension Noble_Extended_Order_Grid
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Noble/AdminOrderGrid/Block/Sales/Order/Grid.php ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category Noble
5
+ * @package Noble_AdminOrderGrid
6
+ * @author Gilles Lesire
7
+ *
8
+ * Class Noble_AdminOrderGrid_Block_Sales_Order_Grid
9
+ * This class overrides the default orders grid in the Admin panel
10
+ */
11
+ class Noble_AdminOrderGrid_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ $this->setId('sales_order_grid');
18
+ $this->setUseAjax(true);
19
+ $this->setDefaultSort('created_at');
20
+ $this->setDefaultDir('DESC');
21
+ $this->setSaveParametersInSession(true);
22
+ }
23
+
24
+ /**
25
+ * Retrieve collection class
26
+ *
27
+ * @return string
28
+ */
29
+ protected function _getCollectionClass()
30
+ {
31
+ return 'sales/order_grid_collection';
32
+ }
33
+
34
+ protected function _prepareCollection()
35
+ {
36
+ $orderFields = array();
37
+ $billingFields = array();
38
+ $shippingFields = array();
39
+ $paymentFields = array();
40
+
41
+ if(Mage::getStoreConfig('noble/extended_columns/shipping_method')) {
42
+ $orderFields["shipping_method"] = "shipping_method";
43
+ }
44
+
45
+ if(Mage::getStoreConfig('noble/extended_columns/customer_email')) {
46
+ $orderFields["customer_email"] = "customer_email";
47
+ }
48
+
49
+ if(Mage::getStoreConfig('noble/extended_columns/amount_items')) {
50
+ $orderFields["total_qty_ordered"] = "ROUND(total_qty_ordered,0)";
51
+ }
52
+
53
+ if(Mage::getStoreConfig('noble/extended_columns/customer_group')) {
54
+ $orderFields["customer_group_id"] = "customer_group_id";
55
+ }
56
+
57
+ if(Mage::getStoreConfig('noble/extended_columns/subtotal')) {
58
+ $orderFields["subtotal"] = "subtotal";
59
+ }
60
+
61
+ if(Mage::getStoreConfig('noble/extended_columns/billing_country')) {
62
+ $billingFields["billing_country"] = "sfoba.country_id";
63
+ }
64
+
65
+ if(Mage::getStoreConfig('noble/extended_columns/shipping_country')) {
66
+ $billingFields["shipping_country"] = "sfosa.country_id";
67
+ }
68
+
69
+ if(Mage::getStoreConfig('noble/extended_columns/payment_method')) {
70
+ $paymentFields["payment_method"] = "sfop.method";
71
+ }
72
+
73
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
74
+ $collection->getSelect()->join(Mage::getConfig()->getTablePrefix() . 'sales_flat_order as sfo', 'sfo.entity_id=`main_table`.entity_id', $orderFields)
75
+ ->join(Mage::getConfig()->getTablePrefix() . 'sales_flat_order_address as sfoba', 'sfoba.parent_id=`main_table`.entity_id and sfoba.address_type = "billing"', $billingFields)
76
+ ->join(Mage::getConfig()->getTablePrefix() . 'sales_flat_order_address as sfosa', 'sfosa.parent_id=`main_table`.entity_id and sfosa.address_type = "shipping"', $shippingFields)
77
+ ->join(Mage::getConfig()->getTablePrefix() . 'sales_flat_order_payment as sfop', 'sfop.parent_id=`main_table`.entity_id', $paymentFields);
78
+
79
+ $this->setCollection($collection);
80
+ return parent::_prepareCollection();
81
+ }
82
+
83
+ protected function _prepareColumns()
84
+ {
85
+
86
+ if(Mage::getStoreConfig('noble/default_columns/real_order_id')) {
87
+ $this->addColumn('real_order_id', array(
88
+ 'header'=> Mage::helper('sales')->__('Order #'),
89
+ 'width' => '80px',
90
+ 'type' => 'text',
91
+ 'index' => 'increment_id',
92
+ 'filter_index' => 'main_table.increment_id'
93
+ ));
94
+ }
95
+
96
+ if(Mage::getStoreConfig('noble/default_columns/store_id')) {
97
+ if (!Mage::app()->isSingleStoreMode()) {
98
+ $this->addColumn('store_id', array(
99
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
100
+ 'index' => 'store_id',
101
+ 'type' => 'store',
102
+ 'store_view'=> true,
103
+ 'display_deleted' => true,
104
+ 'filter_index' => 'sfo.store_id'
105
+ ));
106
+ }
107
+ }
108
+
109
+ if(Mage::getStoreConfig('noble/default_columns/created_at')) {
110
+ $this->addColumn('created_at', array(
111
+ 'header' => Mage::helper('sales')->__('Purchased On'),
112
+ 'index' => 'created_at',
113
+ 'type' => 'datetime',
114
+ 'width' => '100px',
115
+ 'filter_index' => 'main_table.created_at'
116
+ ));
117
+ }
118
+
119
+ if(Mage::getStoreConfig('noble/default_columns/billing_name')) {
120
+ $this->addColumn('billing_name', array(
121
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
122
+ 'index' => 'billing_name',
123
+ 'filter_index' => 'main_table.billing_name'
124
+ ));
125
+ }
126
+
127
+ if(Mage::getStoreConfig('noble/default_columns/shipping_name')) {
128
+ $this->addColumn('shipping_name', array(
129
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
130
+ 'index' => 'shipping_name',
131
+ 'filter_index' => 'main_table.shipping_name'
132
+ ));
133
+ }
134
+
135
+ if(Mage::getStoreConfig('noble/extended_columns/amount_items')) {
136
+ $this->addColumn('total_qty_ordered', array(
137
+ 'header' => $this->__('# of Items'),
138
+ 'type' => 'int',
139
+ 'index' => 'total_qty_ordered',
140
+ 'width' => '40px'
141
+ ));
142
+ }
143
+
144
+ if(Mage::getStoreConfig('noble/default_columns/base_grand_total')) {
145
+ $this->addColumn('base_grand_total', array(
146
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
147
+ 'index' => 'base_grand_total',
148
+ 'type' => 'currency',
149
+ 'currency' => 'base_currency_code',
150
+ ));
151
+ }
152
+
153
+ if(Mage::getStoreConfig('noble/default_columns/grand_total')) {
154
+ $this->addColumn('grand_total', array(
155
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
156
+ 'index' => 'grand_total',
157
+ 'type' => 'currency',
158
+ 'currency' => 'order_currency_code',
159
+ ));
160
+ }
161
+
162
+ if(Mage::getStoreConfig('noble/extended_columns/subtotal')) {
163
+ $this->addColumn('subtotal', array(
164
+ 'header' => Mage::helper('sales')->__('Subtotal'),
165
+ 'index' => 'subtotal',
166
+ 'type' => 'currency',
167
+ 'currency' => 'order_currency_code',
168
+ ));
169
+ }
170
+
171
+
172
+ if(Mage::getStoreConfig('noble/default_columns/status')) {
173
+ $this->addColumn('status', array(
174
+ 'header' => $this->__('Status'),
175
+ 'index' => 'status',
176
+ 'type' => 'options',
177
+ 'width' => '70px',
178
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
179
+ 'filter_index' => 'main_table.status'
180
+ ));
181
+ }
182
+
183
+ if(Mage::getStoreConfig('noble/extended_columns/customer_group')) {
184
+ $this->addColumn('customer_group_id', array(
185
+ 'header' => Mage::helper('customer')->__('Customer Group'),
186
+ 'width' => '100',
187
+ 'index' => 'customer_group_id',
188
+ 'type' => 'options',
189
+ 'options' => $this->getCustomerGroupOptions(),
190
+ 'renderer' => 'noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_CustomerGroup'
191
+ ));
192
+ }
193
+
194
+ if(Mage::getStoreConfig('noble/extended_columns/shipping_method')) {
195
+ $this->addColumn('shipping_method', array(
196
+ 'header' => $this->__('Shipping method'),
197
+ 'index' => 'shipping_method',
198
+ 'filter_index' => 'sfo.shipping_method',
199
+ 'type' => 'options',
200
+ 'options' => $this->getShippingMethodOptions(),
201
+ 'renderer' => 'noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Shippingmethod'
202
+ ));
203
+ }
204
+
205
+ if(Mage::getStoreConfig('noble/extended_columns/customer_email')) {
206
+ $this->addColumn('customer_email', array(
207
+ 'header' => $this->__('Customer email'),
208
+ 'index' => 'customer_email'
209
+ ));
210
+ }
211
+
212
+ if(Mage::getStoreConfig('noble/extended_columns/billing_country')) {
213
+ $this->addColumn('billing_country', array(
214
+ 'header' => Mage::helper('sales')->__('Billing Country'),
215
+ 'index' => 'billing_country',
216
+ 'filter_index' => 'sfoba.country_id',
217
+ 'width' => '60'
218
+ ));
219
+ }
220
+
221
+ if(Mage::getStoreConfig('noble/extended_columns/shipping_country')) {
222
+ $this->addColumn('shipping_country', array(
223
+ 'header' => Mage::helper('sales')->__('Shipping Country'),
224
+ 'index' => 'shipping_country',
225
+ 'filter_index' => 'sfosa.country_id',
226
+ 'width' => '60'
227
+ ));
228
+ }
229
+
230
+ if(Mage::getStoreConfig('noble/extended_columns/payment_method')) {
231
+ $this->addColumn('payment_method', array(
232
+ 'header' => Mage::helper('sales')->__('Payment method'),
233
+ 'index' => 'payment_method',
234
+ 'filter_index' => 'sfop.method',
235
+ 'type' => 'options',
236
+ 'options' => $this->getPaymentMethodOptions(),
237
+ 'renderer' => 'noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Paymentmethod',
238
+ 'width' => '60'
239
+ ));
240
+ }
241
+
242
+ if(Mage::getStoreConfig('noble/default_columns/action')) {
243
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
244
+ $this->addColumn('action',
245
+ array(
246
+ 'header' => Mage::helper('sales')->__('Action'),
247
+ 'width' => '50px',
248
+ 'type' => 'action',
249
+ 'getter' => 'getId',
250
+ 'actions' => array(
251
+ array(
252
+ 'caption' => Mage::helper('sales')->__('View'),
253
+ 'url' => array('base'=>'*/sales_order/view'),
254
+ 'field' => 'order_id'
255
+ )
256
+ ),
257
+ 'filter' => false,
258
+ 'sortable' => false,
259
+ 'index' => 'stores',
260
+ 'is_system' => true,
261
+ ));
262
+ }
263
+ }
264
+
265
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
266
+
267
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
268
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
269
+
270
+ return parent::_prepareColumns();
271
+ }
272
+
273
+ protected function _prepareMassaction()
274
+ {
275
+ $this->setMassactionIdField('entity_id');
276
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
277
+ $this->getMassactionBlock()->setUseSelectAll(false);
278
+
279
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
280
+ $this->getMassactionBlock()->addItem('cancel_order', array(
281
+ 'label'=> Mage::helper('sales')->__('Cancel'),
282
+ 'url' => $this->getUrl('*/sales_order/massCancel'),
283
+ ));
284
+ }
285
+
286
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
287
+ $this->getMassactionBlock()->addItem('hold_order', array(
288
+ 'label'=> Mage::helper('sales')->__('Hold'),
289
+ 'url' => $this->getUrl('*/sales_order/massHold'),
290
+ ));
291
+ }
292
+
293
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
294
+ $this->getMassactionBlock()->addItem('unhold_order', array(
295
+ 'label'=> Mage::helper('sales')->__('Unhold'),
296
+ 'url' => $this->getUrl('*/sales_order/massUnhold'),
297
+ ));
298
+ }
299
+
300
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
301
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
302
+ 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
303
+ ));
304
+
305
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
306
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
307
+ 'url' => $this->getUrl('*/sales_order/pdfshipments'),
308
+ ));
309
+
310
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
311
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
312
+ 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
313
+ ));
314
+
315
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
316
+ 'label'=> Mage::helper('sales')->__('Print All'),
317
+ 'url' => $this->getUrl('*/sales_order/pdfdocs'),
318
+ ));
319
+
320
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
321
+ 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
322
+ 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
323
+ ));
324
+
325
+ return $this;
326
+ }
327
+
328
+ public function getRowUrl($row)
329
+ {
330
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
331
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
332
+ }
333
+ return false;
334
+ }
335
+
336
+ public function getGridUrl()
337
+ {
338
+ return $this->getUrl('*/*/grid', array('_current'=>true));
339
+ }
340
+
341
+ /**
342
+ * Returns possible filters for CustomerGroup column.
343
+ *
344
+ * @return array
345
+ */
346
+ public function getCustomerGroupOptions()
347
+ {
348
+ $options = Mage::getResourceModel('customer/group_collection')
349
+ ->addFieldToFilter('customer_group_id', array('gt'=> 0))
350
+ ->load()
351
+ ->toOptionHash();
352
+
353
+ return $options;
354
+ }
355
+
356
+ /**
357
+ * Returns possible filters for ShippingMethod column.
358
+ *
359
+ * @return array
360
+ */
361
+ public function getShippingMethodOptions()
362
+ {
363
+ $options = array();
364
+ $optionText = "";
365
+ $collection = Mage::getModel('sales/order')->getCollection()->addFieldToSelect('shipping_method');
366
+ $collection->getSelect()->group('shipping_method');
367
+ foreach ($collection as $option) {
368
+ $optionText = "";
369
+
370
+ if ($option->getShippingMethod() == "dpdparcelshops_dpdparcelshops") {
371
+ $optionText = 'DPD parcelshop';
372
+ } elseif ($option->getShippingMethod() == "dpdclassic_dpdclassic") {
373
+ $optionText = 'DPD classic';
374
+ } elseif ($option->getShippingMethod() == "freeshipping_freeshipping") {
375
+ $optionText = 'Afhalen bureau';
376
+ } elseif ($option->getShippingMethod() == "ups_03") {
377
+ $optionText = 'UPS Ground';
378
+ }
379
+
380
+ if($optionText) {
381
+ $options[$option->getShippingMethod()] = $optionText;
382
+ }
383
+ }
384
+ return $options;
385
+ }
386
+
387
+ /**
388
+ * Returns possible filters for PaymentMethod column.
389
+ *
390
+ * @return array
391
+ */
392
+ public function getPaymentMethodOptions()
393
+ {
394
+ $options = array();
395
+ $optionText = "";
396
+ $collection = Mage::getModel('sales/order_payment')->getCollection()->addFieldToSelect('method');
397
+ $collection->getSelect()->group('method');
398
+ foreach ($collection as $option) {
399
+ $optionText = "";
400
+
401
+ if ($option->getMethod() == "msp_banktransfer") {
402
+ $optionText = 'MSP Banktransfer';
403
+ } elseif ($option->getMethod() == "msp_directdebit") {
404
+ $optionText = 'MSP Direct Debit';
405
+ } elseif ($option->getMethod() == "msp_directebanking") {
406
+ $optionText = 'MSP Direct Banking';
407
+ } elseif ($option->getMethod() == "msp_giropay") {
408
+ $optionText = 'MSP Giropay';
409
+ } elseif ($option->getMethod() == "msp_ideal") {
410
+ $optionText = 'MSP Ideal';
411
+ } elseif ($option->getMethod() == "msp_maestro") {
412
+ $optionText = 'MSP Maestro';
413
+ } elseif ($option->getMethod() == "msp_mastercard") {
414
+ $optionText = 'MSP Mastercard';
415
+ } elseif ($option->getMethod() == "msp_mistercash") {
416
+ $optionText = 'MSP Mister Cash';
417
+ } elseif ($option->getMethod() == "msp_paypal") {
418
+ $optionText = 'MSP Paypal';
419
+ } elseif ($option->getMethod() == "msp_visa") {
420
+ $optionText = 'MSP Visa';
421
+ } elseif ($option->getMethod() == "paypal") {
422
+ $optionText = 'PayPal';
423
+ }
424
+
425
+ if($optionText) {
426
+ $options[$option->getMethod()] = ucfirst($optionText);
427
+ }
428
+ }
429
+ return $options;
430
+ }
431
+ }
app/code/community/Noble/AdminOrderGrid/Block/Sales/Order/Grid/Renderer/CustomerGroup.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Noble
4
+ * @package Noble_AdminOrderGrid
5
+ * @author Gilles Lesire
6
+ *
7
+ * Class Noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_CustomerGroup
8
+ * This class defines the different customer groups available to filter on in the grid
9
+ */
10
+ class Noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_CustomerGroup extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
11
+ {
12
+ /**
13
+ * Renders select between different customer groups.
14
+ *
15
+ * @param Varien_Object $row
16
+ * @return string
17
+ */
18
+ public function render(Varien_Object $row)
19
+ {
20
+ $value = $row->getData($this->getColumn()->getIndex());
21
+ $group = Mage::getModel('customer/group')->load($value);
22
+ return $group->getCode();
23
+ }
24
+ }
app/code/community/Noble/AdminOrderGrid/Block/Sales/Order/Grid/Renderer/Paymentmethod.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Noble
4
+ * @package Noble_AdminOrderGrid
5
+ * @author Gilles Lesire
6
+ *
7
+ * Class Noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Paymentmethod
8
+ * This class defines the different payment methods available to filter on in the grid
9
+ */
10
+ class Noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Paymentmethod extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
11
+ {
12
+ /**
13
+ * Renders select between payment methods.
14
+ *
15
+ * @param Varien_Object $row
16
+ * @return string
17
+ */
18
+ public function render(Varien_Object $row)
19
+ {
20
+ $value = $row->getData($this->getColumn()->getIndex());
21
+
22
+ if ($value == "msp_banktransfer") {
23
+ return 'MSP Banktransfer';
24
+ } elseif ($value == "msp_directdebit") {
25
+ return 'MSP Direct Debit';
26
+ } elseif ($value == "msp_directebanking") {
27
+ return 'MSP Direct Banking';
28
+ } elseif ($value == "msp_giropay") {
29
+ return 'MSP Giropay';
30
+ } elseif ($value == "msp_ideal") {
31
+ return 'MSP Ideal';
32
+ } elseif ($value == "msp_maestro") {
33
+ return 'MSP Maestro';
34
+ } elseif ($value == "msp_mastercard") {
35
+ return 'MSP Mastercard';
36
+ } elseif ($value == "msp_mistercash") {
37
+ return 'MSP Mister Cash';
38
+ } elseif ($value == "msp_paypal") {
39
+ return 'MSP Paypal';
40
+ } elseif ($value == "msp_visa") {
41
+ return 'MSP Visa';
42
+ } elseif ($value == "paypal") {
43
+ return 'PayPal';
44
+ }
45
+
46
+ return ucfirst($value);
47
+ }
48
+ }
app/code/community/Noble/AdminOrderGrid/Block/Sales/Order/Grid/Renderer/Shippingmethod.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Noble
4
+ * @package Noble_AdminOrderGrid
5
+ * @author Gilles Lesire
6
+ *
7
+ * Class Noblee_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Shippingmethod
8
+ * This class defines the different shipping methods available to filter on in the grid
9
+ */
10
+ class Noble_AdminOrderGrid_Block_Sales_Order_Grid_Renderer_Shippingmethod extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
11
+ {
12
+ /**
13
+ * Renders select between shipping methods.
14
+ *
15
+ * @param Varien_Object $row
16
+ * @return string
17
+ */
18
+ public function render(Varien_Object $row)
19
+ {
20
+ $value = $row->getData($this->getColumn()->getIndex());
21
+ if ($value == "dpdparcelshops_dpdparcelshops") {
22
+ return 'DPD parcelshop';
23
+ } elseif ($value == "dpdclassic_dpdclassic") {
24
+ return 'DPD classic';
25
+ } elseif ($value == "freeshipping_freeshipping") {
26
+ return 'Afhalen bureau';
27
+ } elseif ($value == "ups_03") {
28
+ return 'UPS Ground';
29
+ }
30
+
31
+ return $value;
32
+ }
33
+ }
app/code/community/Noble/AdminOrderGrid/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Noble_AdminOrderGrid_Helper_Data extends Mage_Core_Helper_Abstract{
4
+
5
+ }
app/code/community/Noble/AdminOrderGrid/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <noble>
15
+ <title>Admin Orders Grid Settings</title>
16
+ </noble>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Noble/AdminOrderGrid/etc/config.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Noble_AdminOrderGrid>
5
+ <version>1.0.0</version>
6
+ </Noble_AdminOrderGrid>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <adminhtml>
11
+ <rewrite>
12
+ <sales_order_grid>Noble_AdminOrderGrid_Block_Sales_Order_Grid</sales_order_grid>
13
+ </rewrite>
14
+ </adminhtml>
15
+ </blocks>
16
+ <models>
17
+ <adminordergrid>
18
+ <class>Noble_AdminOrderGrid_Model</class>
19
+ </adminordergrid>
20
+ </models>
21
+ <helpers>
22
+ <adminordergrid>
23
+ <class>Noble_AdminOrderGrid_Helper</class>
24
+ </adminordergrid>
25
+ </helpers>
26
+ </global>
27
+ <default>
28
+ <noble>
29
+ <default_columns>
30
+ <real_order_id>1</real_order_id>
31
+ <store_id>1</store_id>
32
+ <created_at>1</created_at>
33
+ <billing_name>1</billing_name>
34
+ <shipping_name>1</shipping_name>
35
+ <base_grand_total>1</base_grand_total>
36
+ <grand_total>1</grand_total>
37
+ <status>1</status>
38
+ <action>1</action>
39
+ </default_columns>
40
+ <extended_columns>
41
+ <shipping_method>0</shipping_method>
42
+ <payment_method>0</payment_method>
43
+ <shipping_country>0</shipping_country>
44
+ <billing_country>0</billing_country>
45
+ <customer_email>0</customer_email>
46
+ <amount_items>0</amount_items>
47
+ <subtotal>0</subtotal>
48
+ <customer_group>0</customer_group>
49
+ </extended_columns>
50
+ </noble>
51
+ </default>
52
+ </config>
app/code/community/Noble/AdminOrderGrid/etc/system.xml ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <noble module="adminordergrid">
5
+ <label>Noble Extensions</label>
6
+ <sort_order>100</sort_order>
7
+ </noble>
8
+ </tabs>
9
+ <sections>
10
+ <noble translate="label" module="adminordergrid">
11
+ <label>Extended Order Grid</label>
12
+ <tab>noble</tab>
13
+ <sort_order>1</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+
18
+ <groups>
19
+ <default_columns translate="label" module="adminordergrid">
20
+ <label>Default columns</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>100</sort_order>
23
+ <expanded>1</expanded>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <comment><![CDATA[<strong>Configure which columns to show in the admin Orders grid.</strong>]]></comment>
28
+
29
+ <fields>
30
+ <default_global translate="label">
31
+ <label>You can only edit these columns in the global config.</label>
32
+ <frontend_type>label</frontend_type>
33
+ <sort_order>199</sort_order>
34
+ <show_in_default>0</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </default_global>
38
+ <real_order_id translate="label">
39
+ <label>Order #: </label>
40
+ <comment>Order number</comment>
41
+ <frontend_type>select</frontend_type>
42
+ <sort_order>101</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>0</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ </real_order_id>
48
+ <store_id translate="label">
49
+ <label>Purchased From (Store): </label>
50
+ <comment>Even when 'Yes' is selected, the column will only be shown if there are multiple storeviews.</comment>
51
+ <frontend_type>select</frontend_type>
52
+ <sort_order>102</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>0</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ </store_id>
58
+ <created_at translate="label">
59
+ <label>Purchased On: </label>
60
+ <comment>Date of purchase</comment>
61
+ <frontend_type>select</frontend_type>
62
+ <sort_order>103</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>0</show_in_website>
65
+ <show_in_store>0</show_in_store>
66
+ <source_model>adminhtml/system_config_source_yesno</source_model>
67
+ </created_at>
68
+ <billing_name translate="label">
69
+ <label>Bill to Name: </label>
70
+ <frontend_type>select</frontend_type>
71
+ <sort_order>104</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ </billing_name>
77
+ <shipping_name translate="label">
78
+ <label>Ship to Name: </label>
79
+ <frontend_type>select</frontend_type>
80
+ <sort_order>105</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>0</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ </shipping_name>
86
+ <base_grand_total translate="label">
87
+ <label>G.T. (Base): </label>
88
+ <comment>Base Grand Total</comment>
89
+ <frontend_type>select</frontend_type>
90
+ <sort_order>106</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>0</show_in_website>
93
+ <show_in_store>0</show_in_store>
94
+ <source_model>adminhtml/system_config_source_yesno</source_model>
95
+ </base_grand_total>
96
+ <grand_total translate="label">
97
+ <label>G.T. (Purchased): </label>
98
+ <comment>Purchased Grand Total</comment>
99
+ <frontend_type>select</frontend_type>
100
+ <sort_order>107</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>0</show_in_website>
103
+ <show_in_store>0</show_in_store>
104
+ <source_model>adminhtml/system_config_source_yesno</source_model>
105
+ </grand_total>
106
+ <status translate="label">
107
+ <label>Status: </label>
108
+ <frontend_type>select</frontend_type>
109
+ <sort_order>108</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>0</show_in_website>
112
+ <show_in_store>0</show_in_store>
113
+ <source_model>adminhtml/system_config_source_yesno</source_model>
114
+ </status>
115
+ <action translate="label">
116
+ <label>Action: </label>
117
+ <frontend_type>select</frontend_type>
118
+ <sort_order>109</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>0</show_in_website>
121
+ <show_in_store>0</show_in_store>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ </action>
124
+ </fields>
125
+ </default_columns>
126
+ <extended_columns translate="label" module="adminordergrid">
127
+ <label>Extended columns</label>
128
+ <frontend_type>text</frontend_type>
129
+ <expanded>1</expanded>
130
+ <sort_order>200</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ <comment><![CDATA[<strong>Configure which columns to show in the admin Orders grid.</strong>]]></comment>
135
+
136
+ <fields>
137
+ <default_global translate="label">
138
+ <label>You can only edit these columns in the global config.</label>
139
+ <frontend_type>label</frontend_type>
140
+ <sort_order>299</sort_order>
141
+ <show_in_default>0</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </default_global>
145
+ <shipping_method translate="label">
146
+ <label>Shipping Method: </label>
147
+ <frontend_type>select</frontend_type>
148
+ <sort_order>202</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>0</show_in_website>
151
+ <show_in_store>0</show_in_store>
152
+ <source_model>adminhtml/system_config_source_yesno</source_model>
153
+ </shipping_method>
154
+ <payment_method translate="label">
155
+ <label>Payment Method: </label>
156
+ <frontend_type>select</frontend_type>
157
+ <sort_order>203</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>0</show_in_website>
160
+ <show_in_store>0</show_in_store>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ </payment_method>
163
+ <shipping_country translate="label">
164
+ <label>Shipping: Country: </label>
165
+ <frontend_type>select</frontend_type>
166
+ <sort_order>205</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>0</show_in_website>
169
+ <show_in_store>0</show_in_store>
170
+ <source_model>adminhtml/system_config_source_yesno</source_model>
171
+ </shipping_country>
172
+ <billing_country translate="label">
173
+ <label>Billing: Country: </label>
174
+ <frontend_type>select</frontend_type>
175
+ <sort_order>212</sort_order>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>0</show_in_website>
178
+ <show_in_store>0</show_in_store>
179
+ <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ </billing_country>
181
+ <customer_email translate="label">
182
+ <label>Customer Email: </label>
183
+ <frontend_type>select</frontend_type>
184
+ <sort_order>220</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>0</show_in_website>
187
+ <show_in_store>0</show_in_store>
188
+ <source_model>adminhtml/system_config_source_yesno</source_model>
189
+ </customer_email>
190
+ <amount_items translate="label">
191
+ <label># of Items: </label>
192
+ <frontend_type>select</frontend_type>
193
+ <sort_order>221</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>0</show_in_website>
196
+ <show_in_store>0</show_in_store>
197
+ <source_model>adminhtml/system_config_source_yesno</source_model>
198
+ </amount_items>
199
+ <subtotal translate="label">
200
+ <label>Subtotal: </label>
201
+ <frontend_type>select</frontend_type>
202
+ <sort_order>222</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>0</show_in_website>
205
+ <show_in_store>0</show_in_store>
206
+ <source_model>adminhtml/system_config_source_yesno</source_model>
207
+ </subtotal>
208
+ <customer_group translate="label">
209
+ <label>Customer Group: </label>
210
+ <frontend_type>select</frontend_type>
211
+ <sort_order>223</sort_order>
212
+ <show_in_default>1</show_in_default>
213
+ <show_in_website>0</show_in_website>
214
+ <show_in_store>0</show_in_store>
215
+ <source_model>adminhtml/system_config_source_yesno</source_model>
216
+ </customer_group>
217
+ </fields>
218
+ </extended_columns>
219
+ </groups>
220
+ </noble>
221
+ </sections>
222
+ </config>
app/etc/modules/Noble_AdminOrderGrid.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Noble_AdminOrderGrid>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Noble_AdminOrderGrid>
7
+ </modules>
8
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Noble_Extended_Order_Grid</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://github.com/KingIsulgard/Magento-Noble-Extended-Order-Grid/blob/master/license.md">GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This Magento extension gives the user the flexibility to customize the orders grid in the admin.</summary>
10
+ <description>Noble Extended Order Grid&#xD;
11
+ Features Turn off any of the default columns with a simple Yes/No Add new custom columns Available custom columns are: Shipping method Payment method Shipping country Billing country Customer email Amount of items in the order Subtotal Customer Group Implementation Simply upload the files in the app folder to the app folder of your Magento installation. It is recommended to test this on a test server first. The current module has only been tested with Magento Community 1.7 Usually you will be required to log out and log back in in order for it to work. Configuration Configuring the columns is very easy. Just login to your Magento Admin panel, go to Configuration. And on the left choose the "Extended Order Grid" link in the "Noble Extensions" section. More information on github: https://github.com/KingIsulgard/Magento-Noble-Extended-Order-Grid</description>
12
+ <notes>Tested only with Magento Community 1.7</notes>
13
+ <authors><author><name>GIlles Lesire</name><user>NobleHouse</user><email>gilles.lesire@gmail.com</email></author></authors>
14
+ <date>2016-01-29</date>
15
+ <time>08:57:48</time>
16
+ <contents><target name="magecommunity"><dir name="Noble"><dir name="AdminOrderGrid"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Grid"><dir name="Renderer"><file name="CustomerGroup.php" hash="0415c522a79744de05fdbabbe293233d"/><file name="Paymentmethod.php" hash="2bd441864434d36cf455cb8fbf7fd399"/><file name="Shippingmethod.php" hash="fb337469e0f8f40b91d9efc5197c4ce2"/></dir></dir><file name="Grid.php" hash="b5992754a3c38ef77f68bd7adcef2cd5"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f26371c30f43b67fc7e8895e67af20b9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="dd8f9834661e4f43e6fe7b4176431b15"/><file name="config.xml" hash="2a0908eb0240532e133b281c02e0f64b"/><file name="system.xml" hash="2bd02a0fc6d79dc07e9e5781f1b54e8b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Noble_AdminOrderGrid.xml" hash="1637b9c7d1a23394272986444bc3880b"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>4.0.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>