Sunday, August 5, 2012

Magento : Show guest name in last 5 orders magento admin dashboard


Show guest name in last 5 orders magento admin dashboard

On the magento community admin dashboard, Under "Last 5 orders" if there is an order by guest it doesnot show the name of guest customer. There were many instances when my clients wanted to show the names of guest too.
For this i have some suggestions. We can show the name from billing address there instead of the customer name. If you think my suggestion is feasible, i request to add this modification to the coming release of magento.
I have coded for this
In Mage/Adminhtml/Block/Dashboard/Orders/Grid.php about line '51' replace "->joinCustomerName('customer')"  with ->joinCustomerBName('customer')
and  in Mage/Reports/Model/Resource/Order/Collection.php

 add a function
 public function joinCustomerBName($alias = 'name')
    {
        $fields      = array('t2.firstname', 't2.lastname');
        $fieldConcat = $this->getConnection()->getConcatSql($fields, ' ');
        $this->getSelect()
        ->join(array('t2' => 'sales_flat_order_address'),'main_table.billing_address_id = t2.entity_id')->columns(array($alias => $fieldConcat));
       

        return $this;
    }

11 comments:

  1. Excellent tip, was already working on Magento tweaks!

    ReplyDelete
  2. Thanks man! Saved me tons of work!

    ReplyDelete
  3. But by doing this though Guest Name comes but on clicking it , shows error [this order does not exist] and redirects to Sales - > Order page

    ReplyDelete
  4. To anyone looking at this please do ***NOT*** do this. It will break upgrade chain of magento. As soon as you update, your 'CORE' change will be overwritten and thus this functionality will be lost. Use a rewrite of the orders grid block and then implement the above code. Coolio

    ReplyDelete
  5. Great Read! I am impressed on how you make your article easy to understand. I'll come back for more :D

    Japs Buidon is a Social Media Specialist and belongs to a team of Magento Developer in Florida. He loves hiking as well as electronics.

    ReplyDelete
  6. The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up..
    magento development company in bangalore 

    ReplyDelete
  7. This is a great post. I like this topic.This site has lots of advantage. It helps me in many ways.Thanks for posting this again.
    magento development company in bangalore 

    ReplyDelete
  8. hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Front end developer learn from javascript and jquery training in chennai .
    or learn thru Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. javascript and jquery training in chennai

    ReplyDelete