Version Notes
First Release
Download this release
Release Info
Developer | Arron Moss |
Extension | Zero1_CustomOrderGrid |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order.php +10 -0
- app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order/Grid.php +35 -0
- app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order/Grid/Renderer/Product.php +14 -0
- app/code/community/Zero1/CustomOrderGrid/Helper/Data.php +4 -0
- app/code/community/Zero1/CustomOrderGrid/Model/Observer.php +33 -0
- app/code/community/Zero1/CustomOrderGrid/Model/Source/Fields.php +25 -0
- app/code/community/Zero1/CustomOrderGrid/etc/adminhtml.xml +22 -0
- app/code/community/Zero1/CustomOrderGrid/etc/config.xml +53 -0
- app/code/community/Zero1/CustomOrderGrid/etc/system.xml +36 -0
- app/code/community/Zero1/CustomOrderGrid/sql/zero1_customordergrid_setup/mysql4-install-0.1.0.php +6 -0
- app/design/adminhtml/default/default/layout/zero1/customordergrid.xml +18 -0
- app/etc/modules/Zero1_CustomOrderGrid.xml +12 -0
- package.xml +18 -0
app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Block_Sales_Order extends Mage_Adminhtml_Block_Sales_Order
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$this->_blockGroup = 'zero1_customordergrid';
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
|
3 |
+
{
|
4 |
+
protected function _prepareColumns()
|
5 |
+
{
|
6 |
+
// Draw the default columns
|
7 |
+
parent::_prepareColumns();
|
8 |
+
|
9 |
+
// Add the selected columns if they are enabled
|
10 |
+
$enabled_options = Mage::getStoreConfig('zero1_customordergrid/options/columns_to_show');
|
11 |
+
$enabled_options = explode(',', $enabled_options);
|
12 |
+
|
13 |
+
if(in_array('products_ordered', $enabled_options)) {
|
14 |
+
$this->addColumnAfter('products_ordered', array(
|
15 |
+
'header' => Mage::helper('sales')->__('Products Ordered'),
|
16 |
+
'index' => 'products_ordered',
|
17 |
+
'renderer' => 'zero1_customordergrid/sales_order_grid_renderer_product',
|
18 |
+
'type' => 'textarea',
|
19 |
+
'width' => '500px',
|
20 |
+
), 'status');
|
21 |
+
}
|
22 |
+
|
23 |
+
if(in_array('customer_email', $enabled_options)) {
|
24 |
+
$this->addColumnAfter('customer_email', array(
|
25 |
+
'header' => Mage::helper('sales')->__('Customer Email'),
|
26 |
+
'index' => 'customer_email',
|
27 |
+
'type' => 'textarea',
|
28 |
+
), 'status');
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->sortColumnsByOrder();
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/Block/Sales/Order/Grid/Renderer/Product.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Block_Sales_Order_Grid_Renderer_Product extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Render product details
|
6 |
+
*
|
7 |
+
* @param Varien_Object $row
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
public function render(Varien_Object $row)
|
11 |
+
{
|
12 |
+
return nl2br($row->getProductsOrdered());
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/Model/Observer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Model_Observer
|
3 |
+
{
|
4 |
+
public function salesOrderGridCollectionLoadBefore(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
$collection = $observer->getEvent()->getOrderGridCollection();
|
7 |
+
|
8 |
+
$select = $collection->getSelect();
|
9 |
+
|
10 |
+
// Add the selected columns if they are enabled
|
11 |
+
$enabled_options = Mage::getStoreConfig('zero1_customordergrid/options/columns_to_show');
|
12 |
+
$enabled_options = explode(',', $enabled_options);
|
13 |
+
|
14 |
+
if(in_array('products_ordered', $enabled_options)) {
|
15 |
+
$table_sales_flat_order_item = Mage::getSingleton('core/resource')->getTableName('sales/order_item');
|
16 |
+
$select->joinLeft(
|
17 |
+
$table_sales_flat_order_item,
|
18 |
+
'main_table.entity_id = '.$table_sales_flat_order_item.'.order_id',
|
19 |
+
array('products_ordered' => 'GROUP_CONCAT(ROUND(qty_ordered), " x ", name, " (", sku, ")" SEPARATOR "'.PHP_EOL.'")')
|
20 |
+
);
|
21 |
+
$select->group('main_table.entity_id');
|
22 |
+
}
|
23 |
+
|
24 |
+
if(in_array('customer_email', $enabled_options)) {
|
25 |
+
$table_sales_flat_order = Mage::getSingleton('core/resource')->getTableName('sales/order');
|
26 |
+
$select->joinLeft(
|
27 |
+
$table_sales_flat_order,
|
28 |
+
'main_table.entity_id = '.$table_sales_flat_order.'.entity_id',
|
29 |
+
array('customer_email')
|
30 |
+
);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/Model/Source/Fields.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zero1_CustomOrderGrid_Model_Source_Fields
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Retrieve options array
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
$options = array();
|
12 |
+
|
13 |
+
$options[] = array(
|
14 |
+
'label' => 'Products Ordered',
|
15 |
+
'value' => 'products_ordered',
|
16 |
+
);
|
17 |
+
|
18 |
+
$options[] = array(
|
19 |
+
'label' => 'Customer Email',
|
20 |
+
'value' => 'customer_email',
|
21 |
+
);
|
22 |
+
|
23 |
+
return $options;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Zero1/CustomOrderGrid/etc/adminhtml.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<zero1_customordergrid translate="title" module="zero1_customordergrid">
|
12 |
+
<title>Custom Order Grid</title>
|
13 |
+
</zero1_customordergrid>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
</children>
|
19 |
+
</admin>
|
20 |
+
</resources>
|
21 |
+
</acl>
|
22 |
+
</config>
|
app/code/community/Zero1/CustomOrderGrid/etc/config.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Zero1_CustomOrderGrid>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Zero1_CustomOrderGrid>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<zero1_customordergrid>
|
11 |
+
<class>Zero1_CustomOrderGrid_Model</class>
|
12 |
+
</zero1_customordergrid>
|
13 |
+
</models>
|
14 |
+
<blocks>
|
15 |
+
<zero1_customordergrid>
|
16 |
+
<class>Zero1_CustomOrderGrid_Block</class>
|
17 |
+
</zero1_customordergrid>
|
18 |
+
</blocks>
|
19 |
+
<helpers>
|
20 |
+
<zero1_customordergrid>
|
21 |
+
<class>Zero1_CustomOrderGrid_Helper</class>
|
22 |
+
</zero1_customordergrid>
|
23 |
+
</helpers>
|
24 |
+
<resources>
|
25 |
+
<zero1_customordergrid_setup>
|
26 |
+
<setup>
|
27 |
+
<module>Zero1_CustomOrderGrid</module>
|
28 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
29 |
+
</setup>
|
30 |
+
</zero1_customordergrid_setup>
|
31 |
+
</resources>
|
32 |
+
<events>
|
33 |
+
<sales_order_grid_collection_load_before>
|
34 |
+
<observers>
|
35 |
+
<zero1_customordergrid>
|
36 |
+
<type>model</type>
|
37 |
+
<class>zero1_customordergrid/observer</class>
|
38 |
+
<method>salesOrderGridCollectionLoadBefore</method>
|
39 |
+
</zero1_customordergrid>
|
40 |
+
</observers>
|
41 |
+
</sales_order_grid_collection_load_before>
|
42 |
+
</events>
|
43 |
+
</global>
|
44 |
+
<adminhtml>
|
45 |
+
<layout>
|
46 |
+
<updates>
|
47 |
+
<zero1_customordergrid>
|
48 |
+
<file>zero1/customordergrid.xml</file>
|
49 |
+
</zero1_customordergrid>
|
50 |
+
</updates>
|
51 |
+
</layout>
|
52 |
+
</adminhtml>
|
53 |
+
</config>
|
app/code/community/Zero1/CustomOrderGrid/etc/system.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<zero1_customordergrid translate="label" module="zero1_customordergrid">
|
5 |
+
<class>separator-top</class>
|
6 |
+
<label>Custom Order Grid</label>
|
7 |
+
<tab>zero1_core</tab>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>0</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<groups>
|
14 |
+
<options translate="label">
|
15 |
+
<label>General 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 |
+
<columns_to_show translate="label">
|
23 |
+
<label>Columns To Show</label>
|
24 |
+
<frontend_type>multiselect</frontend_type>
|
25 |
+
<source_model>zero1_customordergrid/source_fields</source_model>
|
26 |
+
<sort_order>1</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>0</show_in_website>
|
29 |
+
<show_in_store>0</show_in_store>
|
30 |
+
</columns_to_show>
|
31 |
+
</fields>
|
32 |
+
</options>
|
33 |
+
</groups>
|
34 |
+
</zero1_customordergrid>
|
35 |
+
</sections>
|
36 |
+
</config>
|
app/code/community/Zero1/CustomOrderGrid/sql/zero1_customordergrid_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/zero1/customordergrid.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_grid>
|
4 |
+
<remove name="root"/>
|
5 |
+
|
6 |
+
<reference name="content">
|
7 |
+
<block type="zero1_customordergrid/sales_order_grid" name="sales_order.grid"></block>
|
8 |
+
</reference>
|
9 |
+
</adminhtml_sales_order_grid>
|
10 |
+
|
11 |
+
<adminhtml_sales_order_index>
|
12 |
+
<remove name="sales_order.grid.container"/>
|
13 |
+
|
14 |
+
<reference name="content">
|
15 |
+
<block type="zero1_customordergrid/sales_order" name="zero1_customordergrid.sales_order.grid.container"></block>
|
16 |
+
</reference>
|
17 |
+
</adminhtml_sales_order_index>
|
18 |
+
</layout>
|
app/etc/modules/Zero1_CustomOrderGrid.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Zero1_CustomOrderGrid>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Zero1_Core/>
|
9 |
+
</depends>
|
10 |
+
</Zero1_CustomOrderGrid>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Zero1_CustomOrderGrid</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://shop.zero1.co.uk/LICENSE.txt">Commercial</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adds new fields to the order grid.</summary>
|
10 |
+
<description>Adds new fields to the order grid.</description>
|
11 |
+
<notes>First Release</notes>
|
12 |
+
<authors><author><name>Arron Moss</name><user>zero1limited</user><email>arron.moss@zero1.co.uk</email></author></authors>
|
13 |
+
<date>2013-04-22</date>
|
14 |
+
<time>07:40:30</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Zero1"><dir name="CustomOrderGrid"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Grid"><dir name="Renderer"><file name="Product.php" hash="2bc72bfca53e7b1dd868d9866d57c58d"/></dir></dir><file name="Grid.php" hash="8bec80a831e086c8563b4a49b14cf81a"/></dir><file name="Order.php" hash="2fa73a7f9527969e06a8399b1e574e76"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b13e271f2c77300eff69c62efbd93eb0"/></dir><dir name="Model"><file name="Observer.php" hash="fa77d75a5d3a04261aaa457d047c31cb"/><dir name="Source"><file name="Fields.php" hash="48b894a075b59bee4954f32188e4f574"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c70a0d687271000fe0c0d55a703bf65f"/><file name="config.xml" hash="e11911cf79ef1ea5c649c2382f22a8ce"/><file name="system.xml" hash="db4d422750481b096ee5513abcad7b57"/></dir><dir name="sql"><dir name="zero1_customordergrid_setup"><file name="mysql4-install-0.1.0.php" hash="8fe5d704f8524628b85e438052d54324"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Zero1_CustomOrderGrid.xml" hash="74b37c672011608f456301cbe96fc7db"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="zero1"><file name="customordergrid.xml" hash="bfeb216a6489c319fdf1de5ed1ce6a30"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|