July, 2015

By In Magento

Magento – Dashboard Last 5 Orders are missing Guest Name

The Magento Dashboard is the landing page of Magento administration. From Dashboard you can check site’s activity and performance without the need to open every section. Beside sales related data like lifetime sale, 24hour order activity, there are other interesting things like frequently used search terms within the site and recently viewed products.

One of the interesting sections is ‘Last 5 Orders’ block.
It is a list of a five most recently placed orders in your store. Customer information, items ordered, and the order totals are included. However there is one small issue with this block. All customers that have made order as Guests will not have their names displayed in this block. When you click on blank field it will lead you to Order details page and than you can see customer`s name from Billing/Shipping addresses. It is very annoying if you have a lot of customers that shop as guests and force you to open order page just to see a name of customer.

This issue can be fixed easily with small modification. Since it is really small change we will not create our own module and instead we will overwrite Magento core files. To apply changes propelly we will not edit core files directly, we will copy core files into ‘local’ folder following same path strucutre.

Files that we need to copy are (create all missing folders):
to a folder:

to a folder:

Open file ‘Collection.php’ and find function ‘joinCustomerName’ and bellow it add new function:
public function joinCustomerBillingName($alias = 'name')
$fields = array('t2.firstname', 't2.lastname');
$fieldConcat = $this->getConnection()->getConcatSql($fields, ' ');
->join(array('t2' => 'sales_flat_order_address'),'main_table.billing_address_id = t2.entity_id',array($alias => $fieldConcat));
return $this;

Idea is to use Billing information first and last name instead Customer data, that way we will have names displayed for guests too.
After adding function we will call it in file ‘Grid.php’ file, find line:
and replace it with:

While we still have ‘Grid.php’ file opened in editor we will add one more column that will show status of an order so you can really see if it is necessary to open order details page. Find function ‘_prepareColumns’ and copy this code wherever you want ‘Order status’ to appear in ‘Last 5 Orders’ block.

$this->addColumn('status', array(
'header' => Mage::helper('sales')->__('Status'),
'index' => 'status',
'type' => 'options',
'width' => '70px',
'sortable' => false,
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),

If for some reason instructions that I provided are not clear enough here is the patch file, all that you need to do is to download and unpack file from this link. After that copy files into your Magento installation root folder, pay attention that there are no files that will be overwritten. Once upload is done login into admin and check Dashboard, guests names should appear same as it was case for regular customers.

Be sure to make backup of your store before applying patch, in case that issue appears you will be able to easily revert changes.

Read more