mano_msk
mano_msk

Reputation: 51

How to add additional fields in magento order report?

In magento admin panel Sales->Orders shows list of orders. There is a option called Export. This only exports the column showing in orders grid. I need to add more columns ( item names, attributes,discount price etc..) and I don't want to show these additional fields in grid.

How can I achieve this. For order CSV export , what file I need to edit?

Thanks in advance.

Upvotes: 0

Views: 2407

Answers (1)

Rohit Goel
Rohit Goel

Reputation: 3554

HI for this you can copy the file from

app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php

to

app/code/core/local/Adminhtml/Block/Sales/Order/Grid.php

and in the new file you can add new functions like

protected function csvColumns() {
        $this->addColumn('real_order_id', array(
            'header'=> Mage::helper('sales')->__('Order ID'),
            'width' => '80px',
            'type'  => 'text',
            'index' => 'increment_id',
        ));

                $this->addColumn('store_id', array(
                    'header'    => Mage::helper('sales')->__('Purchased From (Store)'),
                    'index'     => 'store_id',
                    'type'      => 'store',
                    'store_view'=> true,
                    'display_deleted' => true,
                ));


            $this->addColumn('created_at', array(
                'header' => Mage::helper('sales')->__('Order Date'),
                'index' => 'created_at',
                'type' => 'datetime',
                'width' => '100px',             
            ));
}

you can add as many as field in this which is in your sales table

and for xml export you can add a one more function named as

protected function xmlColumns() { }

and same you can add as many as fields in this. these will just appear in your export not in your grid.

Let me know if there is any confusion. thanks

Upvotes: 1

Related Questions