I want to add a custom column in magento order grid which should have a input field to populate. This is for screen purpose only so that agent can see information quickly and populate it.

customer Need extra accessories column

input field (Agent can write yes or no whatever) Like this below

enter image description here

So, I want a idea that from where i can start?


jessay,This case you can use rendered concept.

  1. Rewrite class Mage_Adminhtml_Block_Sales_Order_Grid.
  2. _prepareColumns function add yourfield

protected function _prepareColumns() { $this->addColumnAfter('customer_id', array( 'header' => Mage::helper('sales')->__('Title'), 'align' => 'center', 'renderer' => 'Mymoduleblockoprefix/adminhtml_sales_order_renderer_myfield', 'index' => 'customer_id', ),'shipping_name');

    return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();


3.Then using rendered at you can add button on which updta the data

    extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
    public function render(Varien_Object $row)
        $html = parent::render($row);

        $html .= '<button onclick="updateField(this, '. $row->getId() .'); return false">' . Mage::helper('sales')->__('Update') . '</button>';

        return $html;


Create admin layout in where you have write JavaScript.... which call ajax request which you can update the field put your layout file into app/design/adminhtml/default/default/layout/namespace/ folder with content:

<?xml version="1.0"?>
        <reference name="js">
            <block type="core/template" template="namespace/modulename/inline-edit.phtml" />

By using we are adding a new block to block defined in main.xml layout of the backend. And because it has type of core/text_list it will render all of its child blocks automatically Finally lets create template file with our JavaScript logic:

<script type="text/javascript">
function updateTitle(button, fieldId)
    new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('*/*/updateTitle') ?>', {
        method: 'post',
        parameters: { id: fieldId, title: $(button).previous('input').getValue() }

See more at http://www.atwix.com/magento/inline-editing-in-magento-backend-grids/

| improve this answer | |

If you're talking about the grid on admin page Sales -> Orders, then you can copy this file:


to here:


And then only modify the file in your local folder.

If you look at the _prepareColumns method, you can see there are calls to $this->addColumn. You can add your own columns this way.

And then if you want an edit box in each row, you can try using 'type' => 'edit', I think that's the correct type name.

| improve this answer | |
  • Yes i am taking about sales > orders and these two files are same! – Jeassy dailk Feb 25 '15 at 1:40
  • 1
    Copying files to the local namespace to adjust functionality is not good practice. You will be setting yourself up for fail one day you want to upgrade core to new version. Prefer to extend – ProxiBlue Oct 28 '16 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.