Skip to main content
added 2308 characters in body
Source Link
Prashant Valanda
  • 12.7k
  • 5
  • 43
  • 69

add below code in gridhelper file in function _prepareColumnsapp/code/local/Atwix/ExtendedGrid/Helper/Data.php

$this->addColumn public function getPostcodeColumnParams('postcode',)
    {
        return array(
            'header'    => Mage::helper('sales')->__('Postcode'),
            'index' => 'postcode',
            'type' => 'postcode'
'text',        )       
        );
    } 

change code of file app/design/adminhtml/default/default/layout/atwix/extendedgrid.xml

 <sales_order_grid_update_handle>
            <reference name="sales_order.grid">
                <action method="addColumnAfter">
                    <columnId>payment_method</columnId>
                    <arguments>
                        <header>Payment Method</header>
                        <index>payment_method</index>
                        <filter_index>payment.method</filter_index>
                        <type>text</type>
                    </arguments>
                    <after>shipping_name</after>
                </action>
                <action method="addColumnAfter">
                    <columnId>skus</columnId>
                    <arguments helper="atwix_extendedgrid/getSkusColumnParams" />
                    <after>payment_method</after>
                </action>
            </reference>
        </sales_order_grid_update_handle>

to:

 <sales_order_grid_update_handle>
        <reference name="sales_order.grid">
            <action method="addColumnAfter">
                <columnId>payment_method</columnId>
                <arguments>
                    <header>Payment Method</header>
                    <index>payment_method</index>
                    <filter_index>payment.method</filter_index>
                    <type>text</type>
                </arguments>
                <after>shipping_name</after>
            </action>
            <action method="addColumnAfter">
                <columnId>skus</columnId>
                <arguments helper="atwix_extendedgrid/getSkusColumnParams" />
                <after>payment_method</after>
            </action>
            <action method="addColumnAfter">
                <columnId>postcode</columnId>
                <arguments helper="atwix_extendedgrid/getPostcodeColumnParams" />
                <after>skus</after>
            </action>
        </reference>
    </sales_order_grid_update_handle>

add below code in grid file in function _prepareColumns

$this->addColumn('postcode',
        array(
            'header'    => Mage::helper('sales')->__('Postcode'),
            'index'     => 'postcode'
        )
    );

add below code in helper file app/code/local/Atwix/ExtendedGrid/Helper/Data.php

 public function getPostcodeColumnParams()
    {
        return array(
            'header' => 'Postcode',
            'index' => 'postcode',
            'type' => 'text',               
        );
    } 

change code of file app/design/adminhtml/default/default/layout/atwix/extendedgrid.xml

 <sales_order_grid_update_handle>
            <reference name="sales_order.grid">
                <action method="addColumnAfter">
                    <columnId>payment_method</columnId>
                    <arguments>
                        <header>Payment Method</header>
                        <index>payment_method</index>
                        <filter_index>payment.method</filter_index>
                        <type>text</type>
                    </arguments>
                    <after>shipping_name</after>
                </action>
                <action method="addColumnAfter">
                    <columnId>skus</columnId>
                    <arguments helper="atwix_extendedgrid/getSkusColumnParams" />
                    <after>payment_method</after>
                </action>
            </reference>
        </sales_order_grid_update_handle>

to:

 <sales_order_grid_update_handle>
        <reference name="sales_order.grid">
            <action method="addColumnAfter">
                <columnId>payment_method</columnId>
                <arguments>
                    <header>Payment Method</header>
                    <index>payment_method</index>
                    <filter_index>payment.method</filter_index>
                    <type>text</type>
                </arguments>
                <after>shipping_name</after>
            </action>
            <action method="addColumnAfter">
                <columnId>skus</columnId>
                <arguments helper="atwix_extendedgrid/getSkusColumnParams" />
                <after>payment_method</after>
            </action>
            <action method="addColumnAfter">
                <columnId>postcode</columnId>
                <arguments helper="atwix_extendedgrid/getPostcodeColumnParams" />
                <after>skus</after>
            </action>
        </reference>
    </sales_order_grid_update_handle>
Source Link
Prashant Valanda
  • 12.7k
  • 5
  • 43
  • 69

Add below code in collection of app/code/local/Atwix/ExtendedGrid/Model/Observer.php:

$collection = $observer->getOrderGridCollection();
        $select = $collection->getSelect();
        $select->joinLeft(array('payment' => $collection->getTable('sales/order_payment')), 'payment.parent_id=main_table.entity_id', array('payment_method' => 'method'));

        $select->join(
                array('address' => $collection->getTable("sales/order_address")),
                'main_table.entity_id = address.parent_id AND address.address_type = "shipping"',
                array('postcode')
            );

        $select->join('sales_flat_order_item', '`sales_flat_order_item`.order_id=`main_table`.entity_id', array('skus' => new Zend_Db_Expr('group_concat(`sales_flat_order_item`.sku SEPARATOR ", ")')));
        $select->group('main_table.entity_id'); 

add below code in grid file in function _prepareColumns

$this->addColumn('postcode',
        array(
            'header'    => Mage::helper('sales')->__('Postcode'),
            'index'     => 'postcode'
        )
    );