Magento – Customize Backend Order Grid to have SKU, E-mail Address, and Phone Number
Magento’s default back-end order grid doesn’t cut it. I recently had a customer that wanted to be able to sort orders by sku, shipping address, shipping state, and customer e-mail address on their magento site. Why did they want to do this? To quickly generate reports I guess, who knows? By default you can’t sort by these items. You have to add the fields to magento which can be some what tricky.
Anyway if you want to change the order grid from this:
To this on your magento web site:
Just follow these few easy steps.
Step one create a new directory on your server at app/code/local/Mage/Adminhtml/Block/Sales/Order
Here we will be creating a file called Grid.php.
First navigate to app/code/core/Mage/Adminhtml/Block/Sales/Order and copy\paste Grid.php into the directory you just created.
Now open up app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php
Let’s say for some reason when you are doing searches in your brand new boxes and you get an error like
SQLSTATE: Integrity constraint violation:1052 Column'status' in where clause is ambiguous
This means you did not add a filter type properly go back a line like this:
This should fix the error and fix your magento web site’s order grid! Now you should be able to sort by sku, address, name, e-mail address. Shoot you can easily add the telephone number to this order grid if you want!
In case you are wondering I referenced these posted. It took me a while to get the SKU’s to play nicely with all of the other information.