Imedia_SalesOrder - Version 1.0.1

Version Notes

First Stable Release

Download this release

Release Info

Developer iMediaDesigns
Extension Imedia_SalesOrder
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Imedia/SalesOrder/Block/Sales/Order/Grid.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Imedia_SalesOrder_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('sales_order_grid');
9
+ $this->setUseAjax(true);
10
+ $this->setDefaultSort('created_at');
11
+ $this->setDefaultDir('DESC');
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _getCollectionClass()
16
+ {
17
+ return 'sales/order_grid_collection';
18
+ }
19
+
20
+ protected function _prepareCollection()
21
+ {
22
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
23
+
24
+ $collection->getSelect()
25
+ ->join(array('im'=>'sales_flat_order'),'im.entity_id = main_table.entity_id',array('im.increment_id','im.store_id','im.created_at','im.customer_email','im.status','im.base_grand_total','im.grand_total'))
26
+ ->join(array('im_item'=>'sales_flat_order_item'),'im_item.order_id = main_table.entity_id',array('product_sku'=>new Zend_Db_Expr('group_concat(im_item.sku SEPARATOR ",")'),'product_name'=>new Zend_Db_Expr('group_concat(im_item.name SEPARATOR ",")')));
27
+
28
+ $collection->getSelect()->group('main_table.entity_id');
29
+
30
+ $this->setCollection($collection);
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ protected function _prepareColumns()
35
+ {
36
+
37
+ $this->addColumn('real_order_id', array(
38
+ 'header'=> Mage::helper('sales')->__('Order #'),
39
+ 'width' => '80px',
40
+ 'type' => 'text',
41
+ 'index' => 'increment_id',
42
+ 'filter_index' => 'im.increment_id',
43
+ ));
44
+
45
+ if (!Mage::app()->isSingleStoreMode()) {
46
+ $this->addColumn('store_id', array(
47
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
48
+ 'index' => 'store_id',
49
+ 'filter_index' => 'im.store_id',
50
+ 'type' => 'store',
51
+ 'store_view'=> true,
52
+ 'display_deleted' => true,
53
+ ));
54
+ }
55
+
56
+ $this->addColumn('created_at', array(
57
+ 'header' => Mage::helper('sales')->__('Purchased On'),
58
+ 'index' => 'created_at',
59
+ 'filter_index' => 'im.created_at',
60
+ 'width'=>'100px',
61
+ 'type' => 'datetime',
62
+ ));
63
+
64
+ $this->addColumn('billing_name', array(
65
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
66
+ 'index' => 'billing_name',
67
+ ));
68
+
69
+ $this->addColumn('shipping_name', array(
70
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
71
+ 'index' => 'shipping_name',
72
+ ));
73
+
74
+ $productName = Mage::getStoreConfig('salesorder/grid_options/show_product_name',Mage::app()->getStore());
75
+ if($productName == 1){
76
+ $this->addColumn('product_name', array(
77
+ 'header' => Mage::helper('Sales')->__('Product Name'),
78
+ 'type' => 'text',
79
+ 'index' => 'product_name',
80
+ 'filter_index' => 'im_item.name',
81
+
82
+ ));
83
+ }
84
+
85
+ $productSku = Mage::getStoreConfig('salesorder/grid_options/show_product_sku',Mage::app()->getStore());
86
+ if($productSku == 1){
87
+ $this->addColumn('product_sku', array(
88
+ 'header' => Mage::helper('Sales')->__('SKU'),
89
+ 'type' => 'text',
90
+ 'index' => 'product_sku',
91
+ 'filter_index' => 'im_item.sku',
92
+
93
+ ));
94
+ }
95
+ $emailValue = Mage::getStoreConfig('salesorder/grid_options/show_customer_email',Mage::app()->getStore());
96
+ if($emailValue == 1){
97
+ $this->addColumn('customer_email', array(
98
+ 'header' => Mage::helper('sales')->__('Customer Email'),
99
+ 'index' => 'customer_email',
100
+ 'type' => 'text',
101
+ 'filter_index' => 'im.customer_email',
102
+ ));
103
+ }
104
+
105
+ $this->addColumn('base_grand_total', array(
106
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
107
+ 'index' => 'base_grand_total',
108
+ 'filter_index' => 'im.base_grand_total',
109
+ 'type' => 'currency',
110
+ 'currency' => 'base_currency_code',
111
+ ));
112
+
113
+ $this->addColumn('grand_total', array(
114
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
115
+ 'index' => 'grand_total',
116
+ 'filter_index' => 'im.grand_total',
117
+ 'type' => 'currency',
118
+ 'currency' => 'order_currency_code',
119
+ ));
120
+
121
+
122
+ $this->addColumn('status', array(
123
+ 'header' => Mage::helper('sales')->__('Status'),
124
+ 'index' => 'status',
125
+ 'filter_index' => 'im.status',
126
+ 'type' => 'options',
127
+ 'width' => '70px',
128
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
129
+ ));
130
+
131
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
132
+ $this->addColumn('action',
133
+ array(
134
+ 'header' => Mage::helper('sales')->__('Action'),
135
+ 'width' => '50px',
136
+ 'type' => 'action',
137
+ 'getter' => 'getId',
138
+ 'actions' => array(
139
+ array(
140
+ 'caption' => Mage::helper('sales')->__('View'),
141
+ 'url' => array('base'=>'*/sales_order/view'),
142
+ 'field' => 'order_id'
143
+ )
144
+ ),
145
+ 'filter' => false,
146
+ 'sortable' => false,
147
+ 'index' => 'stores',
148
+ 'is_system' => true,
149
+ ));
150
+ }
151
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
152
+
153
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
154
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
155
+
156
+ return parent::_prepareColumns();
157
+ }
158
+
159
+ protected function _prepareMassaction()
160
+ {
161
+ $this->setMassactionIdField('entity_id');
162
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
163
+ $this->getMassactionBlock()->setUseSelectAll(false);
164
+
165
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
166
+ $this->getMassactionBlock()->addItem('cancel_order', array(
167
+ 'label'=> Mage::helper('sales')->__('Cancel'),
168
+ 'url' => $this->getUrl('*/sales_order/massCancel'),
169
+ ));
170
+ }
171
+
172
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
173
+ $this->getMassactionBlock()->addItem('hold_order', array(
174
+ 'label'=> Mage::helper('sales')->__('Hold'),
175
+ 'url' => $this->getUrl('*/sales_order/massHold'),
176
+ ));
177
+ }
178
+
179
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
180
+ $this->getMassactionBlock()->addItem('unhold_order', array(
181
+ 'label'=> Mage::helper('sales')->__('Unhold'),
182
+ 'url' => $this->getUrl('*/sales_order/massUnhold'),
183
+ ));
184
+ }
185
+
186
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
187
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
188
+ 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
189
+ ));
190
+
191
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
192
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
193
+ 'url' => $this->getUrl('*/sales_order/pdfshipments'),
194
+ ));
195
+
196
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
197
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
198
+ 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
199
+ ));
200
+
201
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
202
+ 'label'=> Mage::helper('sales')->__('Print All'),
203
+ 'url' => $this->getUrl('*/sales_order/pdfdocs'),
204
+ ));
205
+
206
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
207
+ 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
208
+ 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
209
+ ));
210
+
211
+ return $this;
212
+ }
213
+
214
+ public function getRowUrl($row)
215
+ {
216
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
217
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
218
+ }
219
+ return false;
220
+ }
221
+
222
+ public function getGridUrl()
223
+ {
224
+ return $this->getUrl('*/*/grid', array('_current'=>true));
225
+ }
226
+
227
+ }
app/code/community/Imedia/SalesOrder/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Imedia_SalesOrder_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
5
+ ?>
app/code/community/Imedia/SalesOrder/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <salesorder translate="title">
15
+ <title>Sales Order</title>
16
+ <sort_order>200</sort_order>
17
+ </salesorder>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/Imedia/SalesOrder/etc/config.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Imedia_SalesOrder>
5
+ <version>1.0.0</version>
6
+ </Imedia_SalesOrder>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <adminhtml>
11
+ <rewrite>
12
+ <sales_order_grid>Imedia_SalesOrder_Block_Sales_Order_Grid</sales_order_grid>
13
+ </rewrite>
14
+ </adminhtml>
15
+ </blocks>
16
+ <helpers>
17
+ <salesorder>
18
+ <class>Imedia_SalesOrder_Helper</class>
19
+ </salesorder>
20
+ </helpers>
21
+ </global>
22
+ </config>
app/code/community/Imedia/SalesOrder/etc/system.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <salesorder translate="label">
5
+ <label>Imedia Sales Order Grid</label>
6
+ <tab>general</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>1000</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+
13
+ <groups>
14
+ <grid_options translate="label">
15
+ <label>Grid Options</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <show_product_name translate="label">
23
+ <label>Show Product Name</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <comment>set yes to show product name in sales order grid</comment>
27
+ <sort_order>1</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </show_product_name>
32
+ <show_product_sku translate="label">
33
+ <label>Show Product SKU</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <comment>set yes to show product sku in sales order grid</comment>
37
+ <sort_order>2</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </show_product_sku>
42
+ <show_customer_email translate="label">
43
+ <label>Show Customer Email</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <comment>set yes to show customer email in sales order grid</comment>
47
+ <sort_order>3</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </show_customer_email>
52
+ </fields>
53
+ </grid_options>
54
+ </groups>
55
+
56
+ </salesorder>
57
+ </sections>
58
+ </config>
app/etc/modules/Imedia_SalesOrder.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Imedia_SalesOrder>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Imedia_SalesOrder>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Imedia_SalesOrder</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Enhance sales order grid options</summary>
10
+ <description>With this module you can show following options in sales order Grid&#xD;
11
+ 1. Show Product Name&#xD;
12
+ 2. Show Product SKU&#xD;
13
+ 3. Show Customer Email</description>
14
+ <notes>First Stable Release</notes>
15
+ <authors><author><name>iMediaDesigns</name><user>imediadesigns</user><email>info@imediadesigns.org</email></author></authors>
16
+ <date>2014-04-26</date>
17
+ <time>11:54:35</time>
18
+ <contents><target name="magecommunity"><dir name="Imedia"><dir name="SalesOrder"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="f5c7009c05fd6ad34e2c12822d212429"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="acfbe4ccedec3b0224637d5bd799428a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5e31103eb3e2dec25f31de455d3fb643"/><file name="config.xml" hash="016ec4612e05845ccf51fd7f246eaf14"/><file name="system.xml" hash="fe11cd11743df6f1c4bca253d3411beb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imedia_SalesOrder.xml" hash="85a5c0d609dd0a830a50113acadb6c5f"/></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
21
+ </package>