Version Notes
Reworked extension to use observers instead of rewrites.
Download this release
Release Info
Developer | Hussey Coding |
Extension | HusseyCoding_CustomOrderGrid |
Version | 1.1.3 |
Comparing to | |
See all releases |
Version 1.1.3
- app/code/community/HusseyCoding/Common/etc/system.xml +9 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Block/Sales/Order/Grid/Renderer/TrackingNumber.php +16 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Helper/Data.php +52 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Model/Observer.php +439 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Columns.php +66 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Direction.php +11 -0
- app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Sort.php +47 -0
- app/code/community/HusseyCoding/CustomOrderGrid/etc/adminhtml.xml +25 -0
- app/code/community/HusseyCoding/CustomOrderGrid/etc/config.xml +54 -0
- app/code/community/HusseyCoding/CustomOrderGrid/etc/system.xml +81 -0
- app/design/adminhtml/default/default/layout/customordergrid.xml +11 -0
- app/etc/modules/HusseyCoding_Common.xml +9 -0
- app/etc/modules/HusseyCoding_CustomOrderGrid.xml +9 -0
- package.xml +20 -0
- skin/adminhtml/default/default/customordergrid/js/customordergrid.js +144 -0
app/code/community/HusseyCoding/Common/etc/system.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<husseycoding translate="label">
|
5 |
+
<label>Hussey Coding</label>
|
6 |
+
<sort_order>500</sort_order>
|
7 |
+
</husseycoding>
|
8 |
+
</tabs>
|
9 |
+
</config>
|
app/code/community/HusseyCoding/CustomOrderGrid/Block/Sales/Order/Grid/Renderer/TrackingNumber.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Block_Sales_Order_Grid_Renderer_TrackingNumber extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$order = Mage::getModel('sales/order')->load((int) $row->getId());
|
7 |
+
$tracking = $order->getTracksCollection();
|
8 |
+
if ($tracking->count()):
|
9 |
+
foreach ($tracking as $track):
|
10 |
+
$html = '<a href="javascript:void(0)" onclick="popWin(\'' . Mage::helper('shipping')->getTrackingPopupUrlBySalesModel($order) . '\',\'trackorder\',\'width=800,height=600,resizable=yes,scrollbars=yes\')">' . $track->getTrackNumber() . '</a>';
|
11 |
+
endforeach;
|
12 |
+
endif;
|
13 |
+
|
14 |
+
return isset($html) ? $html : '';
|
15 |
+
}
|
16 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/Helper/Data.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function registeredStatuses()
|
5 |
+
{
|
6 |
+
return array(1 => 'Guest', 0 => 'Registered');
|
7 |
+
}
|
8 |
+
|
9 |
+
public function virtualStatuses()
|
10 |
+
{
|
11 |
+
return array(1 => 'Yes', 0 => 'No');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function paymentMethods()
|
15 |
+
{
|
16 |
+
$data = array();
|
17 |
+
foreach (Mage::getModel('payment/config')->getActiveMethods() as $method):
|
18 |
+
$data[$method->getCode()] = $method->getTitle();
|
19 |
+
endforeach;
|
20 |
+
|
21 |
+
return $data;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function ccTypes()
|
25 |
+
{
|
26 |
+
$data = array();
|
27 |
+
foreach (Mage::getModel('payment/config')->getCcTypes() as $code => $title):
|
28 |
+
$data[$code] = $title;
|
29 |
+
endforeach;
|
30 |
+
|
31 |
+
return $data;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function shippingMethods()
|
35 |
+
{
|
36 |
+
$data = array();
|
37 |
+
foreach (Mage::getModel('shipping/config')->getActiveCarriers() as $carrier):
|
38 |
+
$methods = $carrier->getAllowedMethods();
|
39 |
+
if (!empty($methods)):
|
40 |
+
foreach ($methods as $code => $title):
|
41 |
+
$code = $carrier->getCarrierCode() . '_' . $code;
|
42 |
+
$title = Mage::getStoreConfig('carriers/' . $carrier->getCarrierCode() . '/title') . ' - ' . $title;
|
43 |
+
if (!empty($code) && !empty($title)):
|
44 |
+
$data[$code] = $title;
|
45 |
+
endif;
|
46 |
+
endforeach;
|
47 |
+
endif;
|
48 |
+
endforeach;
|
49 |
+
|
50 |
+
return $data;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/Model/Observer.php
ADDED
@@ -0,0 +1,439 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Model_Observer extends Varien_Event_Observer
|
3 |
+
{
|
4 |
+
public function adminhtmlCoreBlockAbstractPrepareLayoutBefore($observer)
|
5 |
+
{
|
6 |
+
if ($observer->getBlock()->getType() == 'adminhtml/widget_grid_massaction'):
|
7 |
+
if ($block = Mage::app()->getLayout()->getBlock('sales_order.grid')):
|
8 |
+
if ($this->_isEnabled() && $block->getColumns()):
|
9 |
+
$sort = Mage::getStoreConfig('customordergrid/configure/columnsort');
|
10 |
+
if (!$sort || $sort == 'tracking_number'):
|
11 |
+
$sort = 'real_order_id';
|
12 |
+
endif;
|
13 |
+
$direction = Mage::getStoreConfig('customordergrid/configure/sortdirection') ? Mage::getStoreConfig('customordergrid/configure/sortdirection') : 'DESC';
|
14 |
+
$block->setDefaultSort($sort)->setDefaultDir($direction);
|
15 |
+
|
16 |
+
if (method_exists($block, 'removeColumn')):
|
17 |
+
$block
|
18 |
+
->removeColumn('store_id')
|
19 |
+
->removeColumn('created_at')
|
20 |
+
->removeColumn('billing_name')
|
21 |
+
->removeColumn('shipping_name')
|
22 |
+
->removeColumn('base_grand_total')
|
23 |
+
->removeColumn('grand_total')
|
24 |
+
->removeColumn('status');
|
25 |
+
endif;
|
26 |
+
|
27 |
+
$selected = Mage::getStoreConfig('customordergrid/configure/columnsorder');
|
28 |
+
$selected = !empty($selected) ? explode(',', $selected) : array();
|
29 |
+
$selected = array_reverse($selected);
|
30 |
+
$widths = Mage::getStoreConfig('customordergrid/configure/columnswidth');
|
31 |
+
$widths = isset($widths) ? explode(',', $widths) : array();
|
32 |
+
$columnWidths = array();
|
33 |
+
foreach ($widths as $width):
|
34 |
+
$split = explode(':', $width);
|
35 |
+
if (!empty($split[1])):
|
36 |
+
$thiswidth = preg_replace('/\D/', '', $split[1]);
|
37 |
+
else:
|
38 |
+
$thiswidth = '';
|
39 |
+
endif;
|
40 |
+
$columnWidths[$split[0]] = $thiswidth;
|
41 |
+
endforeach;
|
42 |
+
|
43 |
+
foreach ($selected as $column):
|
44 |
+
$width = empty($columnWidths[$column]) ? null : $columnWidths[$column] . 'px';
|
45 |
+
$this->_addNewColumn($column, $block, $width);
|
46 |
+
endforeach;
|
47 |
+
$block->sortColumnsByOrder();
|
48 |
+
endif;
|
49 |
+
endif;
|
50 |
+
endif;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function adminhtmlSalesOrderGridCollectionLoadBefore($observer)
|
54 |
+
{
|
55 |
+
if ($this->_isEnabled()):
|
56 |
+
$selected = Mage::getStoreConfig('customordergrid/configure/columnsorder');
|
57 |
+
$selected = isset($selected) && $selected ? explode(',', $selected) : false;
|
58 |
+
|
59 |
+
$select = $observer->getOrderGridCollection()->getSelect();
|
60 |
+
$resource = Mage::getSingleton('core/resource');
|
61 |
+
|
62 |
+
$select
|
63 |
+
->join(
|
64 |
+
array('order' => $resource->getTableName('sales/order')),
|
65 |
+
'main_table.entity_id = order.entity_id',
|
66 |
+
array('is_virtual', 'shipping_method', 'coupon_code', 'customer_email', 'base_shipping_amount', 'shipping_amount', 'base_subtotal', 'subtotal', 'base_tax_amount', 'tax_amount', 'customer_is_guest', 'total_qty_ordered', 'base_discount_amount', 'total_item_count')
|
67 |
+
);
|
68 |
+
|
69 |
+
$billing = array('billing_company', 'billing_postcode', 'billing_region', 'billing_country');
|
70 |
+
$shipping = array('shipping_company', 'shipping_postcode', 'shipping_region', 'shipping_country');
|
71 |
+
|
72 |
+
if (array_intersect($billing, $selected)):
|
73 |
+
$select->join(
|
74 |
+
array('billing' => $resource->getTableName('sales/order_address')),
|
75 |
+
'order.billing_address_id = billing.entity_id',
|
76 |
+
array('billing_company' => 'company', 'billing_postcode' => 'postcode', 'billing_region' => 'region', 'billing_country' => 'country_id')
|
77 |
+
);
|
78 |
+
endif;
|
79 |
+
|
80 |
+
if (array_intersect($shipping, $selected)):
|
81 |
+
$select->joinLeft(
|
82 |
+
array('shipping' => $resource->getTableName('sales/order_address')),
|
83 |
+
'order.shipping_address_id = shipping.entity_id',
|
84 |
+
array('shipping_company' => 'company', 'shipping_postcode' => 'postcode', 'shipping_region' => 'region', 'shipping_country' => 'country_id')
|
85 |
+
);
|
86 |
+
endif;
|
87 |
+
|
88 |
+
if (in_array('method', $selected) || in_array('cc_type', $selected)):
|
89 |
+
$select->join(
|
90 |
+
array('payment_method' => $resource->getTableName('sales/order_payment')),
|
91 |
+
'order.entity_id = payment_method.parent_id',
|
92 |
+
array('method', 'cc_type')
|
93 |
+
);
|
94 |
+
endif;
|
95 |
+
|
96 |
+
if (in_array('sku', $selected) || in_array('name', $selected)):
|
97 |
+
$select->joinLeft('sales_flat_order_item',
|
98 |
+
'sales_flat_order_item.order_id = main_table.entity_id AND sales_flat_order_item.product_type = "simple"',
|
99 |
+
array('sku' => new Zend_Db_Expr('GROUP_CONCAT(sales_flat_order_item.sku SEPARATOR ", ")'), 'name' => new Zend_Db_Expr('GROUP_CONCAT(sales_flat_order_item.name SEPARATOR ", ")'))
|
100 |
+
);
|
101 |
+
$select->group('main_table.entity_id');
|
102 |
+
endif;
|
103 |
+
endif;
|
104 |
+
}
|
105 |
+
|
106 |
+
private function _addNewColumn($column, $block, $width)
|
107 |
+
{
|
108 |
+
switch ($column):
|
109 |
+
case 'store_id':
|
110 |
+
if (!Mage::app()->isSingleStoreMode()):
|
111 |
+
$block->addColumnAfter('store_id', array(
|
112 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
113 |
+
'index' => 'store_id',
|
114 |
+
'filter_index' => 'main_table.store_id',
|
115 |
+
'type' => 'store',
|
116 |
+
'store_view'=> true,
|
117 |
+
'display_deleted' => true,
|
118 |
+
'width' => $width
|
119 |
+
), 'real_order_id');
|
120 |
+
endif;
|
121 |
+
break;
|
122 |
+
case 'created_at':
|
123 |
+
$block->addColumnAfter('created_at', array(
|
124 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
125 |
+
'index' => 'created_at',
|
126 |
+
'filter_index' => 'main_table.created_at',
|
127 |
+
'type' => 'datetime',
|
128 |
+
'width' => $width
|
129 |
+
), 'real_order_id');
|
130 |
+
break;
|
131 |
+
case 'updated_at':
|
132 |
+
$block->addColumnAfter('updated_at', array(
|
133 |
+
'header' => Mage::helper('sales')->__('Order Modified'),
|
134 |
+
'index' => 'updated_at',
|
135 |
+
'filter_index' => 'main_table.updated_at',
|
136 |
+
'type' => 'datetime',
|
137 |
+
'width' => $width
|
138 |
+
), 'real_order_id');
|
139 |
+
break;
|
140 |
+
case 'billing_name':
|
141 |
+
$block->addColumnAfter('billing_name', array(
|
142 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
143 |
+
'index' => 'billing_name',
|
144 |
+
'width' => $width
|
145 |
+
), 'real_order_id');
|
146 |
+
break;
|
147 |
+
case 'shipping_name':
|
148 |
+
$block->addColumnAfter('shipping_name', array(
|
149 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
150 |
+
'index' => 'shipping_name',
|
151 |
+
'width' => $width
|
152 |
+
), 'real_order_id');
|
153 |
+
break;
|
154 |
+
case 'base_grand_total':
|
155 |
+
$block->addColumnAfter('base_grand_total', array(
|
156 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
157 |
+
'index' => 'base_grand_total',
|
158 |
+
'filter_index' => 'main_table.base_grand_total',
|
159 |
+
'type' => 'currency',
|
160 |
+
'currency' => 'base_currency_code',
|
161 |
+
'width' => $width
|
162 |
+
), 'real_order_id');
|
163 |
+
break;
|
164 |
+
case 'grand_total':
|
165 |
+
$block->addColumnAfter('grand_total', array(
|
166 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
167 |
+
'index' => 'grand_total',
|
168 |
+
'filter_index' => 'main_table.grand_total',
|
169 |
+
'type' => 'currency',
|
170 |
+
'currency' => 'order_currency_code',
|
171 |
+
'width' => $width
|
172 |
+
), 'real_order_id');
|
173 |
+
break;
|
174 |
+
case 'billing_company':
|
175 |
+
$block->addColumnAfter('billing_company', array(
|
176 |
+
'header' => Mage::helper('sales')->__('Billing Company'),
|
177 |
+
'index' => 'billing_company',
|
178 |
+
'filter_index' => 'billing.company',
|
179 |
+
'width' => $width
|
180 |
+
), 'real_order_id');
|
181 |
+
break;
|
182 |
+
case 'shipping_company':
|
183 |
+
$block->addColumnAfter('shipping_company', array(
|
184 |
+
'header' => Mage::helper('sales')->__('Ship to Company'),
|
185 |
+
'index' => 'shipping_company',
|
186 |
+
'filter_index' => 'shipping.company',
|
187 |
+
'width' => $width
|
188 |
+
), 'real_order_id');
|
189 |
+
break;
|
190 |
+
case 'status':
|
191 |
+
$block->addColumnAfter('status', array(
|
192 |
+
'header' => Mage::helper('sales')->__('Status'),
|
193 |
+
'index' => 'status',
|
194 |
+
'filter_index' => 'main_table.status',
|
195 |
+
'type' => 'options',
|
196 |
+
'width' => $width,
|
197 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses()
|
198 |
+
), 'real_order_id');
|
199 |
+
break;
|
200 |
+
case 'sku':
|
201 |
+
$block->addColumnAfter('sku', array(
|
202 |
+
'header' => Mage::helper('sales')->__('SKU'),
|
203 |
+
'index' => 'sku',
|
204 |
+
'width' => $width
|
205 |
+
), 'real_order_id');
|
206 |
+
break;
|
207 |
+
case 'name':
|
208 |
+
$block->addColumnAfter('name', array(
|
209 |
+
'header' => Mage::helper('sales')->__('Product Name'),
|
210 |
+
'index' => 'name',
|
211 |
+
'filter_index' => 'sku_table.name',
|
212 |
+
'width' => $width
|
213 |
+
), 'real_order_id');
|
214 |
+
break;
|
215 |
+
case 'is_virtual':
|
216 |
+
$block->addColumnAfter('is_virtual', array(
|
217 |
+
'header' => Mage::helper('sales')->__('Is Virtual'),
|
218 |
+
'index' => 'is_virtual',
|
219 |
+
'filter_index' => 'order.is_virtual',
|
220 |
+
'type' => 'options',
|
221 |
+
'width' => $width,
|
222 |
+
'options' => Mage::helper('customordergrid')->virtualStatuses()
|
223 |
+
), 'real_order_id');
|
224 |
+
break;
|
225 |
+
case 'shipping_method':
|
226 |
+
$block->addColumnAfter('shipping_method', array(
|
227 |
+
'header' => Mage::helper('sales')->__('Shipping Method'),
|
228 |
+
'index' => 'shipping_method',
|
229 |
+
'type' => 'options',
|
230 |
+
'width' => $width,
|
231 |
+
'options' => Mage::helper('customordergrid')->shippingMethods()
|
232 |
+
), 'real_order_id');
|
233 |
+
break;
|
234 |
+
case 'coupon_code':
|
235 |
+
$block->addColumnAfter('coupon_code', array(
|
236 |
+
'header' => Mage::helper('sales')->__('Coupon Code'),
|
237 |
+
'index' => 'coupon_code',
|
238 |
+
'width' => $width
|
239 |
+
), 'real_order_id');
|
240 |
+
break;
|
241 |
+
case 'customer_email':
|
242 |
+
$block->addColumnAfter('customer_email', array(
|
243 |
+
'header' => Mage::helper('sales')->__('Customer Email'),
|
244 |
+
'index' => 'customer_email',
|
245 |
+
'width' => $width
|
246 |
+
), 'real_order_id');
|
247 |
+
break;
|
248 |
+
case 'base_shipping_amount':
|
249 |
+
$block->addColumnAfter('base_shipping_amount', array(
|
250 |
+
'header' => Mage::helper('sales')->__('Shipping (Base)'),
|
251 |
+
'index' => 'base_shipping_amount',
|
252 |
+
'filter_index' => 'order.base_shipping_amount',
|
253 |
+
'type' => 'currency',
|
254 |
+
'currency' => 'base_currency_code',
|
255 |
+
'width' => $width
|
256 |
+
), 'real_order_id');
|
257 |
+
break;
|
258 |
+
case 'shipping_amount':
|
259 |
+
$block->addColumnAfter('shipping_amount', array(
|
260 |
+
'header' => Mage::helper('sales')->__('Shipping (Purchased)'),
|
261 |
+
'index' => 'shipping_amount',
|
262 |
+
'filter_index' => 'order.shipping_amount',
|
263 |
+
'type' => 'currency',
|
264 |
+
'currency' => 'order_currency_code',
|
265 |
+
'width' => $width
|
266 |
+
), 'real_order_id');
|
267 |
+
break;
|
268 |
+
case 'base_subtotal':
|
269 |
+
$block->addColumnAfter('base_subtotal', array(
|
270 |
+
'header' => Mage::helper('sales')->__('Subtotal (Base)'),
|
271 |
+
'index' => 'base_subtotal',
|
272 |
+
'filter_index' => 'order.base_subtotal',
|
273 |
+
'type' => 'currency',
|
274 |
+
'currency' => 'base_currency_code',
|
275 |
+
'width' => $width
|
276 |
+
), 'real_order_id');
|
277 |
+
break;
|
278 |
+
case 'subtotal':
|
279 |
+
$block->addColumnAfter('subtotal', array(
|
280 |
+
'header' => Mage::helper('sales')->__('Subtotal (Purchased)'),
|
281 |
+
'index' => 'subtotal',
|
282 |
+
'filter_index' => 'order.subtotal',
|
283 |
+
'type' => 'currency',
|
284 |
+
'currency' => 'order_currency_code',
|
285 |
+
'width' => $width
|
286 |
+
), 'real_order_id');
|
287 |
+
break;
|
288 |
+
case 'base_tax_amount':
|
289 |
+
$block->addColumnAfter('base_tax_amount', array(
|
290 |
+
'header' => Mage::helper('sales')->__('Tax (Base)'),
|
291 |
+
'index' => 'base_tax_amount',
|
292 |
+
'filter_index' => 'order.base_tax_amount',
|
293 |
+
'type' => 'currency',
|
294 |
+
'currency' => 'base_currency_code',
|
295 |
+
'width' => $width
|
296 |
+
), 'real_order_id');
|
297 |
+
break;
|
298 |
+
case 'tax_amount':
|
299 |
+
$block->addColumnAfter('tax_amount', array(
|
300 |
+
'header' => Mage::helper('sales')->__('Tax (Purchased)'),
|
301 |
+
'index' => 'tax_amount',
|
302 |
+
'filter_index' => 'order.tax_amount',
|
303 |
+
'type' => 'currency',
|
304 |
+
'currency' => 'order_currency_code',
|
305 |
+
'width' => $width
|
306 |
+
), 'real_order_id');
|
307 |
+
break;
|
308 |
+
case 'customer_is_guest':
|
309 |
+
$block->addColumnAfter('customer_is_guest', array(
|
310 |
+
'header' => Mage::helper('sales')->__('Guest Checkout'),
|
311 |
+
'index' => 'customer_is_guest',
|
312 |
+
'filter_index' => 'order.customer_is_guest',
|
313 |
+
'type' => 'options',
|
314 |
+
'width' => $width,
|
315 |
+
'options' => Mage::helper('customordergrid')->registeredStatuses()
|
316 |
+
), 'real_order_id');
|
317 |
+
break;
|
318 |
+
case 'order_currency_code':
|
319 |
+
$block->addColumnAfter('order_currency_code', array(
|
320 |
+
'header' => Mage::helper('sales')->__('Currency'),
|
321 |
+
'index' => 'order_currency_code',
|
322 |
+
'filter_index' => 'main_table.order_currency_code',
|
323 |
+
'width' => $width
|
324 |
+
), 'real_order_id');
|
325 |
+
break;
|
326 |
+
case 'method':
|
327 |
+
$block->addColumnAfter('method', array(
|
328 |
+
'header' => Mage::helper('sales')->__('Payment Method'),
|
329 |
+
'index' => 'method',
|
330 |
+
'filter_index' => 'payment_method.method',
|
331 |
+
'type' => 'options',
|
332 |
+
'options' => Mage::helper('customordergrid')->paymentMethods(),
|
333 |
+
'width' => $width
|
334 |
+
), 'real_order_id');
|
335 |
+
break;
|
336 |
+
case 'cc_type':
|
337 |
+
$block->addColumnAfter('cc_type', array(
|
338 |
+
'header' => Mage::helper('sales')->__('Credit Card Type'),
|
339 |
+
'index' => 'cc_type',
|
340 |
+
'filter_index' => 'payment_method.cc_type',
|
341 |
+
'type' => 'options',
|
342 |
+
'options' => Mage::helper('customordergrid')->ccTypes(),
|
343 |
+
'width' => $width
|
344 |
+
), 'real_order_id');
|
345 |
+
break;
|
346 |
+
case 'total_item_count':
|
347 |
+
$block->addColumnAfter('total_item_count', array(
|
348 |
+
'header' => Mage::helper('sales')->__('Product Count'),
|
349 |
+
'index' => 'total_item_count',
|
350 |
+
'filter_index' => 'order.total_item_count',
|
351 |
+
'type' => 'currency',
|
352 |
+
'width' => $width
|
353 |
+
), 'real_order_id');
|
354 |
+
break;
|
355 |
+
case 'total_qty_ordered':
|
356 |
+
$block->addColumnAfter('total_qty_ordered', array(
|
357 |
+
'header' => Mage::helper('sales')->__('Product Quantity'),
|
358 |
+
'index' => 'total_qty_ordered',
|
359 |
+
'filter_index' => 'order.total_qty_ordered',
|
360 |
+
'type' => 'currency',
|
361 |
+
'width' => $width
|
362 |
+
), 'real_order_id');
|
363 |
+
break;
|
364 |
+
case 'billing_postcode':
|
365 |
+
$block->addColumnAfter('billing_postcode', array(
|
366 |
+
'header' => Mage::helper('sales')->__('Billing Postcode'),
|
367 |
+
'index' => 'billing_postcode',
|
368 |
+
'filter_index' => 'billing.postcode',
|
369 |
+
'width' => $width
|
370 |
+
), 'real_order_id');
|
371 |
+
break;
|
372 |
+
case 'shipping_postcode':
|
373 |
+
$block->addColumnAfter('shipping_postcode', array(
|
374 |
+
'header' => Mage::helper('sales')->__('Ship to Postcode'),
|
375 |
+
'index' => 'shipping_postcode',
|
376 |
+
'filter_index' => 'shipping.postcode',
|
377 |
+
'width' => $width
|
378 |
+
), 'real_order_id');
|
379 |
+
break;
|
380 |
+
case 'billing_region':
|
381 |
+
$block->addColumnAfter('billing_region', array(
|
382 |
+
'header' => Mage::helper('sales')->__('Billing Region'),
|
383 |
+
'index' => 'billing_region',
|
384 |
+
'filter_index' => 'billing.region',
|
385 |
+
'width' => $width
|
386 |
+
), 'real_order_id');
|
387 |
+
break;
|
388 |
+
case 'shipping_region':
|
389 |
+
$block->addColumnAfter('shipping_region', array(
|
390 |
+
'header' => Mage::helper('sales')->__('Ship to Region'),
|
391 |
+
'index' => 'shipping_region',
|
392 |
+
'filter_index' => 'shipping.region',
|
393 |
+
'width' => $width
|
394 |
+
), 'real_order_id');
|
395 |
+
break;
|
396 |
+
case 'billing_country':
|
397 |
+
$block->addColumnAfter('billing_country', array(
|
398 |
+
'header' => Mage::helper('sales')->__('Billing Country'),
|
399 |
+
'index' => 'billing_country',
|
400 |
+
'filter_index' => 'billing.country_id',
|
401 |
+
'width' => $width
|
402 |
+
), 'real_order_id');
|
403 |
+
break;
|
404 |
+
case 'shipping_country':
|
405 |
+
$block->addColumnAfter('shipping_country', array(
|
406 |
+
'header' => Mage::helper('sales')->__('Ship to Country'),
|
407 |
+
'index' => 'shipping_country',
|
408 |
+
'filter_index' => 'shipping.country_id',
|
409 |
+
'width' => $width
|
410 |
+
), 'real_order_id');
|
411 |
+
break;
|
412 |
+
case 'tracking_number':
|
413 |
+
$block->addColumnAfter('tracking_number', array(
|
414 |
+
'header' => Mage::helper('sales')->__('Tracking Number'),
|
415 |
+
'index' => 'tracking_number',
|
416 |
+
'renderer' => 'customordergrid/sales_order_grid_renderer_trackingNumber',
|
417 |
+
'filter' => false,
|
418 |
+
'sortable' => false,
|
419 |
+
'width' => $width
|
420 |
+
), 'real_order_id');
|
421 |
+
break;
|
422 |
+
case 'base_discount_amount':
|
423 |
+
$block->addColumnAfter('base_discount_amount', array(
|
424 |
+
'header' => Mage::helper('sales')->__('Discount (Base)'),
|
425 |
+
'index' => 'base_discount_amount',
|
426 |
+
'filter_index' => 'order.base_discount_amount',
|
427 |
+
'type' => 'currency',
|
428 |
+
'currency' => 'base_currency_code',
|
429 |
+
'width' => $width
|
430 |
+
), 'real_order_id');
|
431 |
+
break;
|
432 |
+
endswitch;
|
433 |
+
}
|
434 |
+
|
435 |
+
private function _isEnabled()
|
436 |
+
{
|
437 |
+
return (bool) Mage::getStoreConfig('customordergrid/configure/enabled');
|
438 |
+
}
|
439 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Columns.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Model_System_Config_Source_Columns
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array(
|
8 |
+
'label' => 'Order Details',
|
9 |
+
'value' => array(
|
10 |
+
array('value' => 'created_at', 'label' => Mage::helper('adminhtml')->__('Purchased On')),
|
11 |
+
array('value' => 'store_id', 'label' => Mage::helper('adminhtml')->__('Purchased From (Store)')),
|
12 |
+
array('value' => 'updated_at', 'label' => Mage::helper('adminhtml')->__('Order Modified')),
|
13 |
+
array('value' => 'status', 'label' => Mage::helper('adminhtml')->__('Status')),
|
14 |
+
array('value' => 'shipping_method', 'label' => Mage::helper('adminhtml')->__('Shipping Method')),
|
15 |
+
array('value' => 'tracking_number', 'label' => Mage::helper('adminhtml')->__('Tracking Number')),
|
16 |
+
array('value' => 'order_currency_code', 'label' => Mage::helper('adminhtml')->__('Currency')),
|
17 |
+
array('value' => 'method', 'label' => Mage::helper('adminhtml')->__('Payment Method')),
|
18 |
+
array('value' => 'cc_type', 'label' => Mage::helper('adminhtml')->__('Credit Card Type'))
|
19 |
+
),
|
20 |
+
),
|
21 |
+
array(
|
22 |
+
'label' => 'Pricing Information',
|
23 |
+
'value' => array(
|
24 |
+
array('value' => 'base_subtotal', 'label' => Mage::helper('adminhtml')->__('Subtotal (Base)')),
|
25 |
+
array('value' => 'subtotal', 'label' => Mage::helper('adminhtml')->__('Subtotal (Purchased)')),
|
26 |
+
array('value' => 'base_grand_total', 'label' => Mage::helper('adminhtml')->__('G.T. (Base)')),
|
27 |
+
array('value' => 'grand_total', 'label' => Mage::helper('adminhtml')->__('G.T. (Purchased)')),
|
28 |
+
array('value' => 'base_tax_amount', 'label' => Mage::helper('adminhtml')->__('Tax (Base)')),
|
29 |
+
array('value' => 'tax_amount', 'label' => Mage::helper('adminhtml')->__('Tax (Purchased)')),
|
30 |
+
array('value' => 'base_shipping_amount', 'label' => Mage::helper('adminhtml')->__('Shipping (Base)')),
|
31 |
+
array('value' => 'shipping_amount', 'label' => Mage::helper('adminhtml')->__('Shipping (Purchased)')),
|
32 |
+
array('value' => 'base_discount_amount', 'label' => Mage::helper('adminhtml')->__('Discount (Base)')),
|
33 |
+
array('value' => 'discount_amount', 'label' => Mage::helper('adminhtml')->__('Discount (Purchased)'))
|
34 |
+
),
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'label' => 'Product Information',
|
38 |
+
'value' => array(
|
39 |
+
array('value' => 'sku', 'label' => Mage::helper('adminhtml')->__('SKU')),
|
40 |
+
array('value' => 'name', 'label' => Mage::helper('adminhtml')->__('Product Name')),
|
41 |
+
array('value' => 'is_virtual', 'label' => Mage::helper('adminhtml')->__('Is Virtual')),
|
42 |
+
array('value' => 'coupon_code', 'label' => Mage::helper('adminhtml')->__('Coupon Code')),
|
43 |
+
array('value' => 'total_item_count', 'label' => Mage::helper('adminhtml')->__('Product Count')),
|
44 |
+
array('value' => 'total_qty_ordered', 'label' => Mage::helper('adminhtml')->__('Product Quantity'))
|
45 |
+
),
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
'label' => 'Customer Details',
|
49 |
+
'value' => array(
|
50 |
+
array('value' => 'billing_name', 'label' => Mage::helper('adminhtml')->__('Billing Name')),
|
51 |
+
array('value' => 'shipping_name', 'label' => Mage::helper('adminhtml')->__('Ship to Name')),
|
52 |
+
array('value' => 'billing_company', 'label' => Mage::helper('adminhtml')->__('Billing Company')),
|
53 |
+
array('value' => 'shipping_company', 'label' => Mage::helper('adminhtml')->__('Ship to Company')),
|
54 |
+
array('value' => 'billing_postcode', 'label' => Mage::helper('adminhtml')->__('Billing Postcode')),
|
55 |
+
array('value' => 'shipping_postcode', 'label' => Mage::helper('adminhtml')->__('Ship to Postcode')),
|
56 |
+
array('value' => 'billing_region', 'label' => Mage::helper('adminhtml')->__('Billing Region')),
|
57 |
+
array('value' => 'shipping_region', 'label' => Mage::helper('adminhtml')->__('Ship to Region')),
|
58 |
+
array('value' => 'billing_country', 'label' => Mage::helper('adminhtml')->__('Billing Country')),
|
59 |
+
array('value' => 'shipping_country', 'label' => Mage::helper('adminhtml')->__('Ship to Country')),
|
60 |
+
array('value' => 'customer_email', 'label' => Mage::helper('adminhtml')->__('Customer Email')),
|
61 |
+
array('value' => 'customer_is_guest', 'label' => Mage::helper('adminhtml')->__('Guest Checkout'))
|
62 |
+
)
|
63 |
+
)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Direction.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Model_System_Config_Source_Direction
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value' => 'DESC', 'label' => Mage::helper('adminhtml')->__('Descending')),
|
8 |
+
array('value' => 'ASC', 'label' => Mage::helper('adminhtml')->__('Ascending'))
|
9 |
+
);
|
10 |
+
}
|
11 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/Model/System/Config/Source/Sort.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HusseyCoding_CustomOrderGrid_Model_System_Config_Source_Sort
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value' => '', 'label' => Mage::helper('adminhtml')->__('-- Please Select --')),
|
8 |
+
array('value' => 'created_at', 'label' => Mage::helper('adminhtml')->__('Purchased On')),
|
9 |
+
array('value' => 'store_id', 'label' => Mage::helper('adminhtml')->__('Purchased From (Store)')),
|
10 |
+
array('value' => 'updated_at', 'label' => Mage::helper('adminhtml')->__('Order Modified')),
|
11 |
+
array('value' => 'status', 'label' => Mage::helper('adminhtml')->__('Status')),
|
12 |
+
array('value' => 'shipping_method', 'label' => Mage::helper('adminhtml')->__('Shipping Method')),
|
13 |
+
array('value' => 'tracking_number', 'label' => Mage::helper('adminhtml')->__('Tracking Number')),
|
14 |
+
array('value' => 'order_currency_code', 'label' => Mage::helper('adminhtml')->__('Currency')),
|
15 |
+
array('value' => 'method', 'label' => Mage::helper('adminhtml')->__('Payment Method')),
|
16 |
+
array('value' => 'cc_type', 'label' => Mage::helper('adminhtml')->__('Credit Card Type')),
|
17 |
+
array('value' => 'base_subtotal', 'label' => Mage::helper('adminhtml')->__('Subtotal (Base)')),
|
18 |
+
array('value' => 'subtotal', 'label' => Mage::helper('adminhtml')->__('Subtotal (Purchased)')),
|
19 |
+
array('value' => 'base_grand_total', 'label' => Mage::helper('adminhtml')->__('G.T. (Base)')),
|
20 |
+
array('value' => 'grand_total', 'label' => Mage::helper('adminhtml')->__('G.T. (Purchased)')),
|
21 |
+
array('value' => 'base_tax_amount', 'label' => Mage::helper('adminhtml')->__('Tax (Base)')),
|
22 |
+
array('value' => 'tax_amount', 'label' => Mage::helper('adminhtml')->__('Tax (Purchased)')),
|
23 |
+
array('value' => 'base_shipping_amount', 'label' => Mage::helper('adminhtml')->__('Shipping (Base)')),
|
24 |
+
array('value' => 'shipping_amount', 'label' => Mage::helper('adminhtml')->__('Shipping (Purchased)')),
|
25 |
+
array('value' => 'base_discount_amount', 'label' => Mage::helper('adminhtml')->__('Discount (Base)')),
|
26 |
+
array('value' => 'discount_amount', 'label' => Mage::helper('adminhtml')->__('Discount (Purchased)')),
|
27 |
+
array('value' => 'sku', 'label' => Mage::helper('adminhtml')->__('SKU')),
|
28 |
+
array('value' => 'name', 'label' => Mage::helper('adminhtml')->__('Product Name')),
|
29 |
+
array('value' => 'is_virtual', 'label' => Mage::helper('adminhtml')->__('Is Virtual')),
|
30 |
+
array('value' => 'coupon_code', 'label' => Mage::helper('adminhtml')->__('Coupon Code')),
|
31 |
+
array('value' => 'total_item_count', 'label' => Mage::helper('adminhtml')->__('Product Count')),
|
32 |
+
array('value' => 'total_qty_ordered', 'label' => Mage::helper('adminhtml')->__('Product Quantity')),
|
33 |
+
array('value' => 'billing_name', 'label' => Mage::helper('adminhtml')->__('Billing Name')),
|
34 |
+
array('value' => 'shipping_name', 'label' => Mage::helper('adminhtml')->__('Ship to Name')),
|
35 |
+
array('value' => 'billing_company', 'label' => Mage::helper('adminhtml')->__('Billing Company')),
|
36 |
+
array('value' => 'shipping_company', 'label' => Mage::helper('adminhtml')->__('Ship to Company')),
|
37 |
+
array('value' => 'billing_postcode', 'label' => Mage::helper('adminhtml')->__('Billing Postcode')),
|
38 |
+
array('value' => 'shipping_postcode', 'label' => Mage::helper('adminhtml')->__('Ship to Postcode')),
|
39 |
+
array('value' => 'billing_region', 'label' => Mage::helper('adminhtml')->__('Billing Region')),
|
40 |
+
array('value' => 'shipping_region', 'label' => Mage::helper('adminhtml')->__('Ship to Region')),
|
41 |
+
array('value' => 'billing_country', 'label' => Mage::helper('adminhtml')->__('Billing Country')),
|
42 |
+
array('value' => 'shipping_country', 'label' => Mage::helper('adminhtml')->__('Ship to Country')),
|
43 |
+
array('value' => 'customer_email', 'label' => Mage::helper('adminhtml')->__('Customer Email')),
|
44 |
+
array('value' => 'customer_is_guest', 'label' => Mage::helper('adminhtml')->__('Guest Checkout'))
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
app/code/community/HusseyCoding/CustomOrderGrid/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
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 |
+
<customordergrid module="customordergrid">
|
15 |
+
<title>Custom Order Grid</title>
|
16 |
+
</customordergrid>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/community/HusseyCoding/CustomOrderGrid/etc/config.xml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HusseyCoding_CustomOrderGrid>
|
5 |
+
<version>1.1.3</version>
|
6 |
+
</HusseyCoding_CustomOrderGrid>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<customordergrid>
|
11 |
+
<class>HusseyCoding_CustomOrderGrid_Block</class>
|
12 |
+
</customordergrid>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<customordergrid>
|
16 |
+
<class>HusseyCoding_CustomOrderGrid_Model</class>
|
17 |
+
</customordergrid>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<customordergrid>
|
21 |
+
<class>HusseyCoding_CustomOrderGrid_Helper</class>
|
22 |
+
</customordergrid>
|
23 |
+
</helpers>
|
24 |
+
</global>
|
25 |
+
<adminhtml>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<customordergrid>
|
29 |
+
<file>customordergrid.xml</file>
|
30 |
+
</customordergrid>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
<events>
|
34 |
+
<core_block_abstract_prepare_layout_before>
|
35 |
+
<observers>
|
36 |
+
<adminhtml_core_block_abstract_prepare_layout_before_customordergrid>
|
37 |
+
<type>model</type>
|
38 |
+
<class>HusseyCoding_CustomOrderGrid_Model_Observer</class>
|
39 |
+
<method>adminhtmlCoreBlockAbstractPrepareLayoutBefore</method>
|
40 |
+
</adminhtml_core_block_abstract_prepare_layout_before_customordergrid>
|
41 |
+
</observers>
|
42 |
+
</core_block_abstract_prepare_layout_before>
|
43 |
+
<sales_order_grid_collection_load_before>
|
44 |
+
<observers>
|
45 |
+
<adminhtml_sales_order_grid_collection_load_before_customordergrid>
|
46 |
+
<type>model</type>
|
47 |
+
<class>HusseyCoding_CustomOrderGrid_Model_Observer</class>
|
48 |
+
<method>adminhtmlSalesOrderGridCollectionLoadBefore</method>
|
49 |
+
</adminhtml_sales_order_grid_collection_load_before_customordergrid>
|
50 |
+
</observers>
|
51 |
+
</sales_order_grid_collection_load_before>
|
52 |
+
</events>
|
53 |
+
</adminhtml>
|
54 |
+
</config>
|
app/code/community/HusseyCoding/CustomOrderGrid/etc/system.xml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<customordergrid translate="label" module="customordergrid">
|
5 |
+
<label>Custom Order Grid</label>
|
6 |
+
<tab>husseycoding</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>1</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>0</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<configure translate="label">
|
14 |
+
<label>Configure Order Grid</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>0</show_in_website>
|
19 |
+
<show_in_store>0</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<enabled>
|
22 |
+
<label>Enabled</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>0</show_in_website>
|
28 |
+
<show_in_store>0</show_in_store>
|
29 |
+
</enabled>
|
30 |
+
<columns>
|
31 |
+
<label>Show Columns</label>
|
32 |
+
<frontend_type>multiselect</frontend_type>
|
33 |
+
<source_model>customordergrid/system_config_source_columns</source_model>
|
34 |
+
<sort_order>2</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>0</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
<can_be_empty>1</can_be_empty>
|
39 |
+
<comment>Ctrl/shift + click to select multiple, Order # always shown</comment>
|
40 |
+
</columns>
|
41 |
+
<columnsorder>
|
42 |
+
<frontend_type>textarea</frontend_type>
|
43 |
+
<sort_order>3</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>0</show_in_website>
|
46 |
+
<show_in_store>0</show_in_store>
|
47 |
+
</columnsorder>
|
48 |
+
<columnswidth>
|
49 |
+
<frontend_type>textarea</frontend_type>
|
50 |
+
<sort_order>4</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>0</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
</columnswidth>
|
55 |
+
<columnsort>
|
56 |
+
<label>Default Sort Column</label>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<source_model>customordergrid/system_config_source_sort</source_model>
|
59 |
+
<sort_order>5</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>0</show_in_website>
|
62 |
+
<show_in_store>0</show_in_store>
|
63 |
+
<can_be_empty>1</can_be_empty>
|
64 |
+
<comment>Defaults to Order #</comment>
|
65 |
+
</columnsort>
|
66 |
+
<sortdirection>
|
67 |
+
<label>Default Column Sort Direction</label>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>customordergrid/system_config_source_direction</source_model>
|
70 |
+
<sort_order>6</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>0</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
<can_be_empty>1</can_be_empty>
|
75 |
+
</sortdirection>
|
76 |
+
</fields>
|
77 |
+
</configure>
|
78 |
+
</groups>
|
79 |
+
</customordergrid>
|
80 |
+
</sections>
|
81 |
+
</config>
|
app/design/adminhtml/default/default/layout/customordergrid.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_system_config_edit>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem">
|
6 |
+
<type>skin_js</type>
|
7 |
+
<name>customordergrid/js/customordergrid.js</name>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
</adminhtml_system_config_edit>
|
11 |
+
</layout>
|
app/etc/modules/HusseyCoding_Common.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HusseyCoding_Common>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</HusseyCoding_Common>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/HusseyCoding_CustomOrderGrid.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HusseyCoding_CustomOrderGrid>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</HusseyCoding_CustomOrderGrid>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>HusseyCoding_CustomOrderGrid</name>
|
4 |
+
<version>1.1.3</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary> Sort and filter the sales order grid by many different columns.</summary>
|
10 |
+
<description>Fully customise your Magento admin order grid with Custom Order Grid.
|
11 |
+

|
12 |
+
This extension allows you to fully customise and sort the order of columns displayed in the admin order grid. It also gives full sorting and filtering capability for all of these columns.</description>
|
13 |
+
<notes>Reworked extension to use observers instead of rewrites.</notes>
|
14 |
+
<authors><author><name>Hussey Coding</name><user>husseycoding</user><email>info@husseycoding.co.uk</email></author></authors>
|
15 |
+
<date>2015-10-16</date>
|
16 |
+
<time>12:33:01</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="HusseyCoding"><dir name="CustomOrderGrid"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Grid"><dir name="Renderer"><file name="TrackingNumber.php" hash="563be82efb84dd74f6e81ca4cb1ef831"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d396189f4d2de7db2e93919693b12f48"/><file name="config.xml" hash="cdd59f682a352e15160a7c9c5988a8e2"/><file name="system.xml" hash="5a39bb373b18c81ffcede9da2d28a9f1"/></dir><dir name="Helper"><file name="Data.php" hash="9c4c8447a849b4c23e70f8a492a4dd18"/></dir><dir name="Model"><file name="Observer.php" hash="46f70db7331f792aeb200ac54bd03c4c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Columns.php" hash="431aa07c84b5bb8bea9b4e4f738d2ddd"/><file name="Direction.php" hash="c0e3e328ac9960f9e6d53a8447a24ce2"/><file name="Sort.php" hash="065b1a959eeaa73da03f6794c783e549"/></dir></dir></dir></dir></dir><dir name="Common"><dir name="etc"><file name="system.xml" hash="6c9ba9f227b9adfc9abf97f17b46fdbf"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HusseyCoding_CustomOrderGrid.xml" hash="89294e8741d10cfcc680a4a1e7ed4e56"/><file name="HusseyCoding_Common.xml" hash="31e82d3d9b3179c2fa9e002f9669da47"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="customordergrid.xml" hash="5210c598b88e2dc6975eaa2936b1c08a"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="customordergrid"><dir name="js"><file name="customordergrid.js" hash="f02aad55b3a3e46e86149c4c09ee6f7e"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|
skin/adminhtml/default/default/customordergrid/js/customordergrid.js
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var selected = Class.create({
|
2 |
+
initialize: function() {
|
3 |
+
$("row_customordergrid_configure_columnsorder").hide();
|
4 |
+
$("row_customordergrid_configure_columnswidth").hide();
|
5 |
+
if ($("customordergrid_configure_columnsorder").value) {
|
6 |
+
this.userselected = $("customordergrid_configure_columnsorder").value.split(",");
|
7 |
+
} else {
|
8 |
+
this.userselected = new Array();
|
9 |
+
}
|
10 |
+
this.selectedwidths = {};
|
11 |
+
this.getWidthArray();
|
12 |
+
this.getText();
|
13 |
+
Event.observe($("customordergrid_configure_columns"), "change", this.updateForm.bindAsEventListener(this));
|
14 |
+
$("row_customordergrid_configure_columns").insert({ after: "<tr><td></td><td class=\"value\"><div style=\"width:240px; display:inline-block\"><span style=\"font-weight:bold\">Column</span> - drag to order</div><div style=\"display:inline-block; font-weight:bold\">Width</div></td></tr><tr><td class=\"label\">Column Display Order</td><td id=\"displaycolumnorder\" class=\"value\"></td></tr>" });
|
15 |
+
this.outputOrder();
|
16 |
+
this.updateSortElement();
|
17 |
+
this.observeWidthInput();
|
18 |
+
},
|
19 |
+
addColumn: function(id) {
|
20 |
+
if (this.userselected.indexOf(id) == -1) {
|
21 |
+
this.userselected.push(id);
|
22 |
+
}
|
23 |
+
if (!this.selectedwidths[id]) {
|
24 |
+
this.selectedwidths[id] = "";
|
25 |
+
}
|
26 |
+
},
|
27 |
+
removeColumn: function(id) {
|
28 |
+
var count = 0;
|
29 |
+
this.userselected.each(function(s) {
|
30 |
+
if (s == id) {
|
31 |
+
this.userselected.splice(count, 1);
|
32 |
+
throw $break;
|
33 |
+
}
|
34 |
+
count++;
|
35 |
+
}.bind(this));
|
36 |
+
},
|
37 |
+
updateForm: function() {
|
38 |
+
this.checkForm();
|
39 |
+
this.outputOrder();
|
40 |
+
this.updateSortElement();
|
41 |
+
this.observeWidthInput();
|
42 |
+
},
|
43 |
+
checkForm: function() {
|
44 |
+
var selectedoptions = {};
|
45 |
+
this.userselected.each(function(s) {
|
46 |
+
selectedoptions[s] = true;
|
47 |
+
}.bind(this));
|
48 |
+
for (var i = 0; i < $("customordergrid_configure_columns").options.length; i++) {
|
49 |
+
var value = $("customordergrid_configure_columns").options[i].value;
|
50 |
+
if (selectedoptions[value] && !$("customordergrid_configure_columns").options[i].selected) {
|
51 |
+
this.removeColumn(value);
|
52 |
+
} else if (!selectedoptions[value] && $("customordergrid_configure_columns").options[i].selected) {
|
53 |
+
this.addColumn(value);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
},
|
57 |
+
getText: function() {
|
58 |
+
this.valuetext = {};
|
59 |
+
this.reversevaluetext = {};
|
60 |
+
for (var i = 0; i < $("customordergrid_configure_columns").options.length; i++) {
|
61 |
+
this.valuetext[$("customordergrid_configure_columns").options[i].value] = $("customordergrid_configure_columns").options[i].text;
|
62 |
+
this.reversevaluetext[$("customordergrid_configure_columns").options[i].text] = $("customordergrid_configure_columns").options[i].value;
|
63 |
+
}
|
64 |
+
},
|
65 |
+
outputOrder: function() {
|
66 |
+
var html = new Array();
|
67 |
+
var hidden = new Array();
|
68 |
+
this.userselected.each(function(s) {
|
69 |
+
if (this.valuetext[s]) {
|
70 |
+
var widthvalue = !this.selectedwidths[s] ? "" : this.selectedwidths[s];
|
71 |
+
html.push("<div class=\"sortables\"><li class=\"sortablevalues\" style=\"width:240px; display:inline-block; cursor:grab\">" + this.valuetext[s] + "</li><input class=\"widthinput\" type=\"text\" name=\"" + this.reversevaluetext[this.valuetext[s]] + "\" value=\"" + widthvalue + "\" style=\"display:inline-block; width:34px\"></div>");
|
72 |
+
hidden.push(s);
|
73 |
+
}
|
74 |
+
}.bind(this));
|
75 |
+
hidden = hidden.join(",");
|
76 |
+
html = html.join("");
|
77 |
+
$("customordergrid_configure_columnsorder").value = hidden;
|
78 |
+
$("displaycolumnorder").update(html);
|
79 |
+
this.createSortable();
|
80 |
+
},
|
81 |
+
updateSortElement: function() {
|
82 |
+
for (var i = 0; i < $("customordergrid_configure_columnsort").options.length; i++) {
|
83 |
+
var el = $("customordergrid_configure_columnsort").options[i];
|
84 |
+
if (this.userselected.indexOf(el.value) >= 0 && el.value != "tracking_number") {
|
85 |
+
el.disabled = false;
|
86 |
+
} else if (el.value && el.value != "real_order_id") {
|
87 |
+
if (el.selected) {
|
88 |
+
el.selected = false;
|
89 |
+
$("customordergrid_configure_columnsort").options[0].selected = true;
|
90 |
+
}
|
91 |
+
el.disabled = true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
},
|
95 |
+
createSortable: function() {
|
96 |
+
Sortable.create("displaycolumnorder", {
|
97 |
+
tag:"div",
|
98 |
+
onChange: function() {
|
99 |
+
var widths = new Array();
|
100 |
+
var columns = new Array();
|
101 |
+
$$("input.widthinput").each(function(e) {
|
102 |
+
widths.push(e.name + ":" + e.value);
|
103 |
+
columns.push(e.name);
|
104 |
+
}.bind(this));
|
105 |
+
widths = widths.join(",");
|
106 |
+
columns = columns.join(",");
|
107 |
+
$("customordergrid_configure_columnswidth").value = widths;
|
108 |
+
$("customordergrid_configure_columnsorder").value = columns;
|
109 |
+
$("customordergrid_configure_columns").value = columns;
|
110 |
+
|
111 |
+
}
|
112 |
+
}
|
113 |
+
);
|
114 |
+
},
|
115 |
+
observeWidthInput: function() {
|
116 |
+
$$("input.widthinput").each(function(e) {
|
117 |
+
e.observe("change", function() {
|
118 |
+
var string = new Array();
|
119 |
+
$$("input.widthinput").each(function(el) {
|
120 |
+
string.push(el.name + ":" + el.value);
|
121 |
+
}.bind(this));
|
122 |
+
string = string.join(",");
|
123 |
+
$("customordergrid_configure_columnswidth").value = string;
|
124 |
+
}.bind(this));
|
125 |
+
}.bind(this));
|
126 |
+
},
|
127 |
+
getWidthArray: function() {
|
128 |
+
if ($("customordergrid_configure_columnswidth").value) {
|
129 |
+
var splitwidths = $("customordergrid_configure_columnswidth").value.split(",");
|
130 |
+
splitwidths.each(function(e) {
|
131 |
+
var splitwidth = e.split(":");
|
132 |
+
var column = splitwidth.shift();
|
133 |
+
var width = splitwidth.shift();
|
134 |
+
this.selectedwidths[column] = width;
|
135 |
+
}.bind(this));
|
136 |
+
}
|
137 |
+
}
|
138 |
+
});
|
139 |
+
|
140 |
+
document.observe("dom:loaded", function() {
|
141 |
+
if ($("customordergrid_configure_columnsorder")) {
|
142 |
+
var selecteditems = new selected();
|
143 |
+
}
|
144 |
+
});
|