Is there a way to add "Postcode" to Sales_Order_Grid in Magento? <p>I am looking for a way to add Shipping or billing postcode to Sales_Order_Grid in magento 1.7</p> <p>I have tried a few different methods but so far the results have either caused an error or a redirect to the main Dashboard when trying to search the custom column.</p> <p>I've created a module to do this but I get an error when trying to access the page:</p> <p>There has been an error processing your request Exception printing is disabled by default for security reasons.</p> <p>Error log record number: 903668493355</p> <pre><code> a:5:{i:0;s:92:"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shipping_postcode' in 'where clause'";i:1;s:6422:"#0 /var/www/mysite.com/htdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo-&gt;_execute(Array) #1 /var/www/mysite.com/htdocs/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql-&gt;_execute(Array) #2 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement-&gt;execute(Array) #3 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('SELECT COUNT(*)...', Array) #4 /var/www/mysite.com/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract-&gt;query('SELECT COUNT(*)...', Array) #5 /var/www/mysite.com/htdocs/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql-&gt;query(Object(Varien_Db_Select), Array) #6 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract-&gt;fetchOne(Object(Varien_Db_Select), Array) #7 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db-&gt;getSize() #8 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection.php(211): Varien_Data_Collection-&gt;getLastPageNumber() #9 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(516): Varien_Data_Collection-&gt;getCurPage() #10 /var/www/mysite.com/htdocs/lib/Varien/Data/Collection/Db.php(563): Varien_Data_Collection_Db-&gt;_renderLimit() #11 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(533): Varien_Data_Collection_Db-&gt;load() #12 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php(61): Mage_Adminhtml_Block_Widget_Grid-&gt;_prepareCollection() #13 /var/www/mysite.com/htdocs/app/code/local/Thaneuk/CustomGrid/Block/Adminhtml/Sales/Order/Grid.php(25): Mage_Adminhtml_Block_Sales_Order_Grid-&gt;_prepareCollection() #14 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): Thaneuk_CustomGrid_Block_Adminhtml_Sales_Order_Grid-&gt;_prepareCollection() #15 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid-&gt;_prepareGrid() #16 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Adminhtml_Block_Widget_Grid-&gt;_beforeToHtml() #17 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml() #18 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_getChildHtml('grid', true) #19 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(77): Mage_Core_Block_Abstract-&gt;getChildHtml('grid') #20 /var/www/mysite.com/htdocs/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container-&gt;getGridHtml() #21 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/uk-dev...') #22 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('adminhtml/defau...') #23 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView() #24 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template-&gt;_toHtml() #25 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template-&gt;_toHtml() #26 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Widget_Container-&gt;_toHtml() #27 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract-&gt;toHtml() #28 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List-&gt;_toHtml() #29 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml() #30 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_getChildHtml('content', true) #31 /var/www/mysite.com/htdocs/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract-&gt;getChildHtml('content') #32 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/uk-dev...') #33 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('adminhtml/defau...') #34 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView() #35 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template-&gt;_toHtml() #36 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template-&gt;_toHtml() #37 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract-&gt;toHtml() #38 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout-&gt;getOutput() #39 /var/www/mysite.com/htdocs/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(95): Mage_Core_Controller_Varien_Action-&gt;renderLayout() #40 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_Sales_OrderController-&gt;indexAction() #41 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action-&gt;dispatch('index') #42 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard-&gt;match(Object(Mage_Core_Controller_Request_Http)) #43 /var/www/mysite.com/htdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front-&gt;dispatch() #44 /var/www/mysite.com/htdocs/app/Mage.php(683): Mage_Core_Model_App-&gt;run(Array) #45 /var/www/mysite.com/htdocs/index.php(87): Mage::run('', 'store') #46 {main}";s:3:"url";s:29:"/index.php/admin/sales_order/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";} </code></pre> <p>I anyone able to assist me please as I also need to be able to search the postcode columns to retrieve the correct order data?!?</p> <pre><code> &lt;?php class Thaneuk_CustomGrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid { public function __construct() { parent::__construct(); $this-&gt;setId('sales_order_grid'); $this-&gt;setUseAjax(true); $this-&gt;setDefaultSort('created_at'); $this-&gt;setDefaultDir('DESC'); $this-&gt;setSaveParametersInSession(true); } protected function _getCollectionClass() { return 'sales/order_grid_collection'; } protected function _prepareCollection() { $collection = Mage::getResourceModel($this-&gt;_getCollectionClass()); $collection-&gt;getSelect()-&gt;join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = shipping',array('postcode')); $this-&gt;setCollection($collection); return parent::_prepareCollection(); } protected function _prepareColumns() { $this-&gt;addColumn('real_order_id', array( 'header'=&gt; Mage::helper('sales')-&gt;__('Order #'), 'width' =&gt; '80px', 'type' =&gt; 'text', 'index' =&gt; 'increment_id', )); if (!Mage::app()-&gt;isSingleStoreMode()) { $this-&gt;addColumn('store_id', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Purchased From (Store)'), 'index' =&gt; 'store_id', 'type' =&gt; 'store', 'store_view'=&gt; true, 'display_deleted' =&gt; true, )); } $this-&gt;addColumn('created_at', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Purchased On'), 'index' =&gt; 'created_at', 'type' =&gt; 'datetime', 'width' =&gt; '100px', )); $this-&gt;addColumn('billing_name', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Bill to Name'), 'index' =&gt; 'billing_name', )); $this-&gt;addColumn('shipping_name', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Ship to Name'), 'index' =&gt; 'shipping_name', )); $this-&gt;addColumnAfter('shipping_postcode', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Postcode'), 'filter_index'=&gt;'main_table.postcode', 'index' =&gt; 'shipping_postcode', ),'method'); $this-&gt;addColumn('base_grand_total', array( 'header' =&gt; Mage::helper('sales')-&gt;__('G.T. (Base)'), 'index' =&gt; 'base_grand_total', 'type' =&gt; 'currency', 'currency' =&gt; 'base_currency_code', )); $this-&gt;addColumn('grand_total', array( 'header' =&gt; Mage::helper('sales')-&gt;__('G.T. (Purchased)'), 'index' =&gt; 'grand_total', 'type' =&gt; 'currency', 'currency' =&gt; 'order_currency_code', )); $this-&gt;addColumn('status', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Status'), 'index' =&gt; 'status', 'type' =&gt; 'options', 'width' =&gt; '70px', 'options' =&gt; Mage::getSingleton('sales/order_config')-&gt;getStatuses(), )); if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/view')) { $this-&gt;addColumn('action', array( 'header' =&gt; Mage::helper('sales')-&gt;__('Action'), 'width' =&gt; '50px', 'type' =&gt; 'action', 'getter' =&gt; 'getId', 'actions' =&gt; array( array( 'caption' =&gt; Mage::helper('sales')-&gt;__('View'), 'url' =&gt; array('base'=&gt;'*/sales_order/view'), 'field' =&gt; 'order_id' ) ), 'filter' =&gt; false, 'sortable' =&gt; false, 'index' =&gt; 'stores', 'is_system' =&gt; true, )); } $this-&gt;addExportType('*/*/exportCsv', Mage::helper('sales')-&gt;__('CSV')); $this-&gt;addExportType('*/*/exportExcel', Mage::helper('sales')-&gt;__('Excel XML')); return parent::_prepareColumns(); } protected function _prepareMassaction() { $this-&gt;setMassactionIdField('entity_id'); $this-&gt;getMassactionBlock()-&gt;setFormFieldName('order_ids'); $this-&gt;getMassactionBlock()-&gt;setUseSelectAll(false); if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/cancel')) { $this-&gt;getMassactionBlock()-&gt;addItem('cancel_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Cancel'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massCancel'), )); } if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/hold')) { $this-&gt;getMassactionBlock()-&gt;addItem('hold_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Hold'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massHold'), )); } if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/unhold')) { $this-&gt;getMassactionBlock()-&gt;addItem('unhold_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Unhold'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/massUnhold'), )); } $this-&gt;getMassactionBlock()-&gt;addItem('pdfinvoices_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Invoices'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfinvoices'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfshipments_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Packingslips'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfshipments'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfcreditmemos_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Credit Memos'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfcreditmemos'), )); $this-&gt;getMassactionBlock()-&gt;addItem('pdfdocs_order', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print All'), 'url' =&gt; $this-&gt;getUrl('*/sales_order/pdfdocs'), )); $this-&gt;getMassactionBlock()-&gt;addItem('print_shipping_label', array( 'label'=&gt; Mage::helper('sales')-&gt;__('Print Shipping Labels'), 'url' =&gt; $this-&gt;getUrl('*/sales_order_shipment/massPrintShippingLabel'), )); return $this; } public function getRowUrl($row) { if (Mage::getSingleton('admin/session')-&gt;isAllowed('sales/order/actions/view')) { return $this-&gt;getUrl('*/sales_order/view', array('order_id' =&gt; $row-&gt;getId())); } return false; } public function getGridUrl() { return $this-&gt;getUrl('*/*/grid', array('_current'=&gt;true)); } } </code></pre> <p>Help is always appreciated. </p>