salesorderitemsgrid - Version 1.0.0

Version Notes

First release th the extension

Download this release

Release Info

Developer Magento Core Team
Extension salesorderitemsgrid
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (20) hide show
  1. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items.php +19 -0
  2. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid.php +205 -0
  3. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/InputInline.php +23 -0
  4. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Itemqty.php +24 -0
  5. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Order.php +17 -0
  6. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Sku.php +17 -0
  7. app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/TextareaInline.php +18 -0
  8. app/code/community/Rofra/Salesorderitemgrid/Helper/Attributes.php +13 -0
  9. app/code/community/Rofra/Salesorderitemgrid/Helper/Data.php +10 -0
  10. app/code/community/Rofra/Salesorderitemgrid/controllers/Adminhtml/Order/ItemsController.php +69 -0
  11. app/code/community/Rofra/Salesorderitemgrid/etc/config.xml +138 -0
  12. app/code/community/Rofra/Salesorderitemgrid/etc/system.xml +172 -0
  13. app/code/community/Rofra/Salesorderitemgrid/sql/salesorderitemgrid_setup/install-1.0.1.php +32 -0
  14. app/code/community/Rofra/Salesorderitemgrid/sql/salesorderitemgrid_setup/upgrade-1.0.1-1.0.2.php +19 -0
  15. app/design/adminhtml/default/default/layout/salesorderitemgrid.xml +8 -0
  16. app/design/adminhtml/default/default/template/salesorderitemgrid/inline-edit.phtml +23 -0
  17. app/design/adminhtml/default/default/template/salesorderitemgrid/order/items.phtml +1 -0
  18. app/etc/modules/Rofra_Salesorderitemgrid.xml +9 -0
  19. app/locale/fr_FR/Rofra_Salesorderitemgrid.csv +9 -0
  20. package.xml +18 -0
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ $this->_blockGroup = 'salesorderitemgrid';
13
+ $this->_controller = 'adminhtml_order_items';
14
+ $this->_headerText = Mage::helper('salesorderitemgrid')->__('Order Items');
15
+
16
+ parent::__construct();
17
+ $this->_removeButton('add');
18
+ }
19
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setId('order_items');
15
+ $this->setDefaultSort('item_id');
16
+ $this->prepareDefaults();
17
+ }
18
+
19
+ protected function prepareDefaults()
20
+ {
21
+ $this->setDefaultLimit( Mage::getStoreConfig( 'salesorderitemgrid/defaults/limit' ) );
22
+ $this->setDefaultPage( Mage::getStoreConfig( 'salesorderitemgrid/defaults/page' ) );
23
+ }
24
+
25
+ protected function _prepareCollection()
26
+ {
27
+ $collection = Mage::getModel('sales/order_item')->getCollection();
28
+ $collection->join(array('og' =>'sales/order_grid'), 'main_table.order_id = og.entity_id', array('billing_name', 'shipping_name', 'increment_id', 'status', 'og_created_at' =>'og.created_at') );
29
+ $collection->join(array('si' => 'cataloginventory/stock_item'), 'main_table.product_id = si.product_id', array('si_qty' => 'si.qty'));
30
+
31
+ // One line per entry (configurable / simple management)
32
+ $collection->addAttributeToFilter('parent_item_id', array('is' => new Zend_Db_Expr('null')));
33
+
34
+ $this->setCollection($collection);
35
+ parent::_prepareCollection();
36
+ return $this;
37
+ }
38
+
39
+
40
+ protected function _prepareColumns()
41
+ {
42
+ $this->addColumn('item_id', array(
43
+ 'header' => Mage::helper('salesorderitemgrid')->__('ID'),
44
+ 'sortable' => true,
45
+ 'width' => '60',
46
+ 'index' => 'item_id'
47
+ ));
48
+
49
+ $this->addColumn('incremental_id', array(
50
+ 'header' => Mage::helper('sales')->__('Order #'),
51
+ 'sortable' => true,
52
+ 'width' => '60',
53
+ 'index' => 'increment_id',
54
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Order',
55
+ ));
56
+
57
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showsstatus')) {
58
+ $this->addColumn('status', array(
59
+ 'header' => Mage::helper('sales')->__('Order Status'),
60
+ 'index' => 'status',
61
+ 'filter_index' => 'status',
62
+ 'type' => 'options',
63
+ 'width' => '70px',
64
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
65
+ ));
66
+ }
67
+
68
+ $this->addColumn('created_at', array(
69
+ 'header' => Mage::helper('sales')->__('Purchased On'),
70
+ 'sortable' => true,
71
+ 'width' => '60',
72
+ 'index' => 'og_created_at',
73
+ 'filter_index' => 'og.created_at',
74
+ 'type' => 'datetime'
75
+ ));
76
+
77
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showbillingname')) {
78
+ $this->addColumn('billing_name', array(
79
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
80
+ 'sortable' => true,
81
+ 'index' => 'billing_name'
82
+ ));
83
+ }
84
+
85
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showshippingname')) {
86
+ $this->addColumn('shipping_name', array(
87
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
88
+ 'sortable' => true,
89
+ 'index' => 'shipping_name'
90
+ ));
91
+ }
92
+
93
+ $this->addColumn('sku', array(
94
+ 'header' => Mage::helper('salesorderitemgrid')->__('SKU'),
95
+ 'sortable' => true,
96
+ 'index' => 'sku',
97
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Sku',
98
+ ));
99
+
100
+ $this->addColumn('name', array(
101
+ 'header' => Mage::helper('catalog')->__('Name'),
102
+ 'sortable' => true,
103
+ 'index' => 'name'
104
+ ));
105
+
106
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtyordered')) {
107
+ $this->addColumn('qty_ordered', array(
108
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Ordered'),
109
+ 'sortable' => true,
110
+ 'index' => 'qty_ordered',
111
+ 'type' => 'currency',
112
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
113
+ ));
114
+ }
115
+
116
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtylive')) {
117
+ $this->addColumn('si_qty', array(
118
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Live'),
119
+ 'sortable' => true,
120
+ 'index' => 'si_qty',
121
+ 'type' => 'currency',
122
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
123
+ ));
124
+ }
125
+
126
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtycancelled')) {
127
+ $this->addColumn('qty_canceled', array(
128
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Cancelled'),
129
+ 'sortable' => true,
130
+ 'index' => 'qty_canceled',
131
+ 'type' => 'currency',
132
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
133
+ ));
134
+ }
135
+
136
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtyshipped')) {
137
+ $this->addColumn('qty_shipped', array(
138
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Shipped'),
139
+ 'sortable' => true,
140
+ 'index' => 'qty_shipped',
141
+ 'type' => 'currency',
142
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
143
+ ));
144
+ }
145
+
146
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtyrefounded')) {
147
+ $this->addColumn('qty_refunded', array(
148
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Refunded'),
149
+ 'sortable' => true,
150
+ 'index' => 'qty_refunded',
151
+ 'type' => 'currency',
152
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
153
+ ));
154
+ }
155
+
156
+ if (Mage::getStoreConfig('salesorderitemgrid/columns/showqtybackordered')) {
157
+ $this->addColumn('qty_backordered', array(
158
+ 'header' => Mage::helper('salesorderitemgrid')->__('Qty Backordered'),
159
+ 'sortable' => true,
160
+ 'index' => 'qty_backordered',
161
+ 'type' => 'currency',
162
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty',
163
+ ));
164
+ }
165
+
166
+ if (Mage::getStoreConfig('salesorderitemgrid/extracolumns/showextracolumn1')) {
167
+ $this->addColumn('column1', array(
168
+ 'header' => Mage::helper('salesorderitemgrid')->__('Column 1'),
169
+ 'align' => 'center',
170
+ 'sortable' => true,
171
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_InputInline',
172
+ 'index' => 'column1',
173
+ ));
174
+ }
175
+
176
+ if (Mage::getStoreConfig('salesorderitemgrid/extracolumns/showextracolumn2')) {
177
+ $this->addColumn('column2', array(
178
+ 'header' => Mage::helper('salesorderitemgrid')->__('Column 2'),
179
+ 'align' => 'center',
180
+ 'sortable' => true,
181
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_InputInline',
182
+ 'index' => 'column2'
183
+ ));
184
+ }
185
+
186
+ if (Mage::getStoreConfig('salesorderitemgrid/extracolumns/showextracolumn3')) {
187
+ $this->addColumn('column3', array(
188
+ 'header' => Mage::helper('salesorderitemgrid')->__('Column 3'),
189
+ 'align' => 'center',
190
+ 'sortable' => true,
191
+ 'renderer' => 'Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_TextareaInline',
192
+ 'index' => 'column3'
193
+ ));
194
+ }
195
+
196
+
197
+ // SPECIAL COLUMNS
198
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
199
+ $this->addExportType('*/*/exportXml', Mage::helper('sales')->__('XML'));
200
+
201
+ return parent::_prepareColumns();
202
+ }
203
+
204
+
205
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/InputInline.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://opensource.org/licenses/OSL-3.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_InputInline
9
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $html = '<input type="text" ';
14
+ $html .= 'name="' . $this->getColumn()->getId() . '" ';
15
+ $html .= 'value="' . $this->htmlEscape($row->getData($this->getColumn()->getIndex())) . '" ';
16
+ $html .= 'class="input-text ' . $this->getColumn()->getInlineCss() . '" onchange="updateTextualField(this, '. $row->getId() .'); return false;"/>';
17
+
18
+ // $html = parent::render($row);
19
+ // $html .= '<button onclick="updateField(this, '. $row->getId() .'); return false">' . Mage::helper('salesorderitemgrid')->__('Update field') . '</button>';
20
+
21
+ return $html;
22
+ }
23
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Itemqty.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Itemqty
9
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $value = $row->getData($this->getColumn()->getIndex());
14
+
15
+ if ((float) $value) {
16
+ $html = $value*1;
17
+ } else {
18
+ $html = $value;
19
+ }
20
+
21
+ $html = strval(intval($value));
22
+ return $html;
23
+ }
24
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Order.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Order
9
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $value = $row->getData($this->getColumn()->getIndex());
14
+ $html ='<a href="' . $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getData('order_id'), 'key' => $this->getCacheKey())) . '" target="_blank" title="' . $value . '" >' . $row->getData($this->getColumn()->getIndex()) . '</a>';
15
+ return $html;
16
+ }
17
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/Sku.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Sku
9
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $value = $row->getData('product_id');
14
+ $html ='<a href="' . $this->getUrl('adminhtml/catalog_product/edit', array('id' => $value, 'key' => $this->getCacheKey())) . '" target="_blank" title="' . $value . '" > ' . $row->getData('sku') . ' </a>';
15
+ return $html;
16
+ }
17
+ }
app/code/community/Rofra/Salesorderitemgrid/Block/Adminhtml/Order/Items/Grid/Renderer/TextareaInline.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_TextareaInline
9
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
10
+ {
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $html = '<textarea rows="4" ';
14
+ $html .= 'name="' . $this->getColumn()->getId() . '" ';
15
+ $html .= 'class="' . $this->getColumn()->getInlineCss() . '" onchange="updateTextualField(this, '. $row->getId() .'); return false;">' . $this->htmlEscape($row->getData($this->getColumn()->getIndex())) . '</textarea> ';
16
+ return $html;
17
+ }
18
+ }
app/code/community/Rofra/Salesorderitemgrid/Helper/Attributes.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Helper_Attributes extends Mage_Core_Helper_Abstract
9
+ {
10
+ const COLUMN1 = 'column1';
11
+ const COLUMN2 = 'column2';
12
+ const COLUMN3 = 'column3';
13
+ }
app/code/community/Rofra/Salesorderitemgrid/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ }
app/code/community/Rofra/Salesorderitemgrid/controllers/Adminhtml/Order/ItemsController.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+ class Rofra_Salesorderitemgrid_Adminhtml_Order_ItemsController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ public function indexAction()
11
+ {
12
+ $this->loadLayout()->_setActiveMenu('sales/order_items');
13
+ $this->_addContent($this->getLayout()->createBlock('salesorderitemgrid/adminhtml_order_items'));
14
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Order Items'));
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function ajaxUpdateFieldAction()
19
+ {
20
+ $fieldId = (int) $this->getRequest()->getParam('id');
21
+ $title = $this->getRequest()->getParam('title');
22
+ $attributeName = $this->getRequest()->getParam('attr');
23
+ if ($fieldId && $attributeName) {
24
+ $model = Mage::getModel('sales/order_item')->load($fieldId);
25
+ $model->setData($attributeName, $title);
26
+ $model->save();
27
+ }
28
+ }
29
+
30
+
31
+ /**
32
+ * Export product grid to CSV format
33
+ */
34
+ public function exportCsvAction()
35
+ {
36
+ $fileName = 'sales_order_items.csv';
37
+ $content = $this->getLayout()->createBlock('salesorderitemgrid/adminhtml_order_items_grid')->getCsv();
38
+
39
+ $this->_sendUploadResponse($fileName, $content);
40
+ }
41
+
42
+ /**
43
+ * Export product grid to XML format
44
+ */
45
+ public function exportXmlAction()
46
+ {
47
+ $fileName = 'sales_order_items.xml';
48
+ $content = $this->getLayout()->createBlock('salesorderitemgrid/adminhtml_order_items_grid')->getXml();
49
+
50
+ $this->_sendUploadResponse($fileName, $content);
51
+ }
52
+
53
+
54
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
55
+ {
56
+ $response = $this->getResponse();
57
+ $response->setHeader('HTTP/1.1 200 OK','');
58
+
59
+ $response->setHeader('Pragma', 'public', true);
60
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
61
+
62
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
63
+ $response->setHeader('Last-Modified', date('r'));
64
+ $response->setHeader('Accept-Ranges', 'bytes');
65
+ $response->setHeader('Content-Length', strlen($content));
66
+ $response->setHeader('Content-type', $contentType);
67
+ $response->setBody($content);
68
+ }
69
+ }
app/code/community/Rofra/Salesorderitemgrid/etc/config.xml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rofra_Salesorderitemgrid>
5
+ <version>1.0.2</version>
6
+ </Rofra_Salesorderitemgrid>
7
+ </modules>
8
+ <global>
9
+
10
+ <sales>
11
+ <quote>
12
+ <item>
13
+ <product_attributes>
14
+ <column1 />
15
+ <column2 />
16
+ <column3 />
17
+ </product_attributes>
18
+ </item>
19
+ </quote>
20
+ </sales>
21
+ <blocks>
22
+ <salesorderitemgrid>
23
+ <class>Rofra_Salesorderitemgrid_Block</class>
24
+ </salesorderitemgrid>
25
+ </blocks>
26
+ <helpers>
27
+ <salesorderitemgrid>
28
+ <class>Rofra_Salesorderitemgrid_Helper</class>
29
+ </salesorderitemgrid>
30
+ </helpers>
31
+ <resources>
32
+ <salesorderitemgrid_setup>
33
+ <setup>
34
+ <module>Rofra_Salesorderitemgrid</module>
35
+ </setup>
36
+ <connection>
37
+ <use>core_setup</use>
38
+ </connection>
39
+ </salesorderitemgrid_setup>
40
+ <salesorderitemgrid_write>
41
+ <connection>
42
+ <use>core_write</use>
43
+ </connection>
44
+ </salesorderitemgrid_write>
45
+ <salesorderitemgrid_read>
46
+ <connection>
47
+ <use>core_read</use>
48
+ </connection>
49
+ </salesorderitemgrid_read>
50
+ </resources>
51
+ </global>
52
+ <admin>
53
+ <routers>
54
+ <adminhtml>
55
+ <args>
56
+ <modules>
57
+ <salesorderitemgrid before="Mage_Adminhtml">Rofra_Salesorderitemgrid_Adminhtml</salesorderitemgrid>
58
+ </modules>
59
+ </args>
60
+ </adminhtml>
61
+ </routers>
62
+ </admin>
63
+ <adminhtml>
64
+ <translate>
65
+ <modules>
66
+ <salesorderitemgrid>
67
+ <files>
68
+ <default>Rofra_Salesorderitemgrid.csv</default>
69
+ </files>
70
+ </salesorderitemgrid>
71
+ </modules>
72
+ </translate>
73
+ <menu>
74
+ <sales>
75
+ <children>
76
+ <order_items translate="title" module="salesorderitemgrid">
77
+ <title>Order Items</title>
78
+ <sort_order>11</sort_order>
79
+ <action>adminhtml/order_items/index</action>
80
+ </order_items>
81
+ </children>
82
+ </sales>
83
+ </menu>
84
+ <layout>
85
+ <updates>
86
+ <salesorderitemgrid>
87
+ <file>salesorderitemgrid.xml</file>
88
+ </salesorderitemgrid>
89
+ </updates>
90
+ </layout>
91
+ <acl>
92
+ <resources>
93
+ <all>
94
+ <title>Allow Everything</title>
95
+ </all>
96
+ <admin>
97
+ <children>
98
+ <system>
99
+ <children>
100
+ <config>
101
+ <children>
102
+ <salesorderitemgrid>
103
+ <title>Sales Order Items Grid</title>
104
+ </salesorderitemgrid>
105
+ </children>
106
+ </config>
107
+ </children>
108
+ </system>
109
+ </children>
110
+ </admin>
111
+ </resources>
112
+ </acl>
113
+ </adminhtml>
114
+ <default>
115
+ <salesorderitemgrid>
116
+ <columns>
117
+ <showsstatus>1</showsstatus>
118
+ <showbillingname>1</showbillingname>
119
+ <showshippingname>1</showshippingname>
120
+ <showqtyordered>1</showqtyordered>
121
+ <showqtycancelled>1</showqtycancelled>
122
+ <showqtyshipped>1</showqtyshipped>
123
+ <showqtyrefounded>1</showqtyrefounded>
124
+ <showqtybackordered>0</showqtybackordered>
125
+ <showqtylive>1</showqtylive>
126
+ </columns>
127
+ <extracolumns>
128
+ <showextracolumn1>1</showextracolumn1>
129
+ <showextracolumn2>1</showextracolumn2>
130
+ <showextracolumn3>1</showextracolumn3>
131
+ </extracolumns>
132
+ <defaults>
133
+ <limit>50</limit>
134
+ <page>1</page>
135
+ </defaults>
136
+ </salesorderitemgrid>
137
+ </default>
138
+ </config>
app/code/community/Rofra/Salesorderitemgrid/etc/system.xml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <config>
3
+ <tabs>
4
+ <rofra translate="label" module="salesorderitemgrid">
5
+ <label>ROFRA Extensions</label>
6
+ <sort_order>900</sort_order>
7
+ </rofra>
8
+ </tabs>
9
+ <sections>
10
+ <salesorderitemgrid translate="label"
11
+ module="salesorderitemgrid">
12
+ <label>Sales Order Items Grid</label>
13
+ <tab>rofra</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>0</show_in_store>
19
+ <groups>
20
+ <about translate="label">
21
+ <label>About This Extension</label>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <comment>
26
+ <![CDATA[
27
+ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
28
+ This module was developed by <a href="http://www.exvoto.org" target="_blank">Rodolphe Franceschi</a> - <b>Architect & Magento Extension Specialist</b>. <br />
29
+ <br/>For docs & examples refer to module related page on Magento Connect.
30
+ <br/>Need an order summary export or more features? Feel free to contact me directly by email.
31
+ </div>
32
+ ]]>
33
+ </comment>
34
+ </about>
35
+ <columns translate="label">
36
+ <label>Grid Columns Options</label>
37
+ <sort_order>50</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <fields>
41
+ <showsstatus translate="label">
42
+ <label>Show "Order Status"</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <sort_order>10</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ </showsstatus>
49
+ <showbillingname translate="label">
50
+ <label>Show "Billing Name"</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>20</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ </showbillingname>
57
+ <showqtyordered translate="label">
58
+ <label>Show "Qty Ordered"</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>30</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ </showqtyordered>
65
+ <showshippingname translate="label">
66
+ <label>Show "Shipping Name"</label>
67
+ <frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_yesno</source_model>
69
+ <sort_order>40</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ </showshippingname>
73
+ <showqtycancelled translate="label">
74
+ <label>Show "Qty Cancelled"</label>
75
+ <frontend_type>select</frontend_type>
76
+ <source_model>adminhtml/system_config_source_yesno</source_model>
77
+ <sort_order>40</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ </showqtycancelled>
81
+ <showqtyshipped translate="label">
82
+ <label>Show "Qty Shipped"</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>50</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ </showqtyshipped>
89
+ <showqtyrefounded translate="label">
90
+ <label>Show "Qty Refounded"</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ <sort_order>60</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ </showqtyrefounded>
97
+ <showqtybackordered translate="label">
98
+ <label>Show "Qty Backordered"</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <sort_order>70</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ </showqtybackordered>
105
+ <showqtylive translate="label">
106
+ <label>Show "Qty Live"</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>adminhtml/system_config_source_yesno</source_model>
109
+ <sort_order>70</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ </showqtylive>
113
+ </fields>
114
+ </columns>
115
+ <extracolumns translate="label">
116
+ <label>Extra-columns Options</label>
117
+ <sort_order>200</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <fields>
121
+ <showextracolumn1 translate="label">
122
+ <label>Show Extra Column 1 (textual)</label>
123
+ <frontend_type>select</frontend_type>
124
+ <source_model>adminhtml/system_config_source_yesno</source_model>
125
+ <sort_order>10</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ </showextracolumn1>
129
+ <showextracolumn2 translate="label">
130
+ <label>Show Extra Column 2 (textual)</label>
131
+ <frontend_type>select</frontend_type>
132
+ <source_model>adminhtml/system_config_source_yesno</source_model>
133
+ <sort_order>20</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ </showextracolumn2>
137
+ <showextracolumn3 translate="label">
138
+ <label>Show Extra Column 3 (textarea)</label>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>adminhtml/system_config_source_yesno</source_model>
141
+ <sort_order>30</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ </showextracolumn3>
145
+ </fields>
146
+ </extracolumns>
147
+ <defaults translate="label">
148
+ <label>Default Grid State</label>
149
+ <sort_order>400</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <fields>
153
+ <limit translate="label">
154
+ <label>Page Size</label>
155
+ <frontend_type>text</frontend_type>
156
+ <sort_order>10</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ </limit>
160
+ <page translate="label">
161
+ <label>Initial Page Number</label>
162
+ <frontend_type>text</frontend_type>
163
+ <sort_order>10</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ </page>
167
+ </fields>
168
+ </defaults>
169
+ </groups>
170
+ </salesorderitemgrid>
171
+ </sections>
172
+ </config>
app/code/community/Rofra/Salesorderitemgrid/sql/salesorderitemgrid_setup/install-1.0.1.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+
9
+ /* @var $installer Mage_Sales_Model_Resource_Setup */
10
+ $installer = new Mage_Sales_Model_Resource_Setup('core_setup');
11
+ /**
12
+ * Add 'custom_attribute' attribute for entities
13
+ */
14
+ $entities = array(
15
+ 'order_item'
16
+ );
17
+
18
+ // Add VARCHAR attributes
19
+ $options = array(
20
+ 'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
21
+ 'visible' => true,
22
+ 'required' => false
23
+ );
24
+
25
+ foreach ($entities as $entity) {
26
+ $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN1, $options);
27
+ $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN2, $options);
28
+ $installer->addAttribute($entity, Rofra_Salesorderitemgrid_Helper_Attributes::COLUMN3, $options);
29
+ }
30
+
31
+
32
+ $installer->endSetup();
app/code/community/Rofra/Salesorderitemgrid/sql/salesorderitemgrid_setup/upgrade-1.0.1-1.0.2.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Graphic Sourcecode
4
+ * @package Rofra_Salesorderitemgrid
5
+ * @license http://www.apache.org/licenses/LICENSE-2.0
6
+ * @author Rodolphe Franceschi <rodolphe.franceschi@gmail.com>
7
+ */
8
+
9
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
10
+ $setup->startSetup();
11
+
12
+ // Change the flags to filter / sort (for flat index)
13
+ $setup->run("
14
+ UPDATE sales_flat_order_item SET column1 = '';
15
+ UPDATE sales_flat_order_item SET column2 = '';
16
+ UPDATE sales_flat_order_item SET column3 = '';
17
+ ");
18
+
19
+ $setup->endSetup();
app/design/adminhtml/default/default/layout/salesorderitemgrid.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_order_items_index>
4
+ <reference name="js">
5
+ <block type="core/template" template="salesorderitemgrid/inline-edit.phtml" />
6
+ </reference>
7
+ </adminhtml_order_items_index>
8
+ </layout>
app/design/adminhtml/default/default/template/salesorderitemgrid/inline-edit.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ function updateField(button, fieldId)
3
+ {
4
+ val = $(button).previous('input').getValue();
5
+ name = $(button).previous('input').getAttribute('name');
6
+ new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('*/*/ajaxUpdateField') ?>', {
7
+ method: 'post',
8
+ parameters: { id: fieldId, title: val, attr: name}
9
+ });
10
+ }
11
+ </script>
12
+
13
+ <script type="text/javascript">
14
+ function updateTextualField(input, fieldId)
15
+ {
16
+ val = $(input).getValue();
17
+ name = $(input).getAttribute('name');
18
+ new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('*/*/ajaxUpdateField') ?>', {
19
+ method: 'post',
20
+ parameters: { id: fieldId, title: val, attr: name}
21
+ });
22
+ }
23
+ </script>
app/design/adminhtml/default/default/template/salesorderitemgrid/order/items.phtml ADDED
@@ -0,0 +1 @@
 
1
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
app/etc/modules/Rofra_Salesorderitemgrid.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rofra_Salesorderitemgrid>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Rofra_Salesorderitemgrid>
8
+ </modules>
9
+ </config>
app/locale/fr_FR/Rofra_Salesorderitemgrid.csv ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ "Order Items","Lignes de commande"
2
+ "Qty Refunded","Qté remboursée"
3
+ "Qty Cancelled","Qté annulée"
4
+ "Update field","MAJ"
5
+ "Qty Backordered","Qté réappro"
6
+ "Qty Live","Qté Live"
7
+ "Column 1","Colonne 1"
8
+ "Column 2","Colonne 2"
9
+ "Column 3","Colonne 3"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>salesorderitemsgrid</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license/>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>New Sales Order items Grid in Sales menu</summary>
10
+ <description>New Grid for viewing the content of the sales/order_item table, the item lines of the orders. It permits you to consult core datas. It allows to you directly save in order items lines custom datas in three custom columns (may be usefull for a tiny ERP).</description>
11
+ <notes>First release th the extension</notes>
12
+ <authors><author><name>Rodolphe Franceschi</name><user>auto-converted</user><email>fedorage@gmail.com</email></author></authors>
13
+ <date>2014-03-13</date>
14
+ <time>17:18:26</time>
15
+ <contents><target name="magecommunity"><dir name="Rofra"><dir name="Salesorderitemgrid"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><dir name="Items"><dir name="Grid"><dir name="Renderer"><file name="InputInline.php" hash="5a9b7dc590a5829ba43a24bbe6c2fb45"/><file name="Itemqty.php" hash="44fd82da2128259ea9747233f857d8b4"/><file name="Order.php" hash="e0efcb5f4e2c1176c223cdb875281a00"/><file name="Sku.php" hash="71cfe8c10faa7414bd8521bd0dac576d"/><file name="TextareaInline.php" hash="2f355ed5c0fb4fea7df36a4f77582aef"/></dir></dir><file name="Grid.php" hash="86d944fc047ad7a9087817b9984b0db1"/></dir><file name="Items.php" hash="39fa190526103c682b40060647b627bd"/></dir></dir></dir><dir name="Helper"><file name="Attributes.php" hash="1bc53662ab1f71706af85aec29038b6c"/><file name="Data.php" hash="be296f5db04d7bdfe12c42d8926f0fcc"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Order"><file name="ItemsController.php" hash="8431381a1f58fb29c2a0070a35974fe9"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="f205fcb522da2a912efc1d4af0257917"/><file name="system.xml" hash="ef2cc216a0541c19257872c9984e1584"/></dir><dir name="sql"><dir name="salesorderitemgrid_setup"><file name="install-1.0.1.php" hash="66f4440fe53e23a503926f09b660fb68"/><file name="upgrade-1.0.1-1.0.2.php" hash="138831c3f5684c51a5eabe526f94174a"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Rofra_Salesorderitemgrid.csv" hash="567da91328bed8c3a5538d92a0c3003d"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="salesorderitemgrid.xml" hash="a28128fa0628d86918beb9290e19e077"/></dir><dir name="template"><dir name="salesorderitemgrid"><dir name="order"><file name="items.phtml" hash="59e794d45697b360e18ba972bada0123"/></dir><file name="inline-edit.phtml" hash="8537cb5f13db577d4c385c6cc951f755"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rofra_Salesorderitemgrid.xml" hash="a941481014e362555ddf7c36a5ff083e"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>