0

Since the upgrade from Magento 1.7 to 1.9, we are not seeing Guest Name under the Last 5 Orders in the Admin Dashboard. I've read that this is because the name is now stored as a whitespace instead of NULL.

I need a way to fix this as I do not know where this record is written at. I'd prefer a way that will not break if we upgrade again.

  • When you say the Gust Name, is this a custom column in that section, or is it the name under Customer? Is the value missing for only orders placed by guests, or also registered customers? – davidalger Mar 30 '15 at 14:32
  • It is the name column. For registered users the name will display, but not for anyone who checks out as a guest. – Charles Wilkins IV Mar 30 '15 at 15:12
0

(Don't edit core files; extend them instead.)

You can use the billing address name by editing the following:

  1. Mage_Adminhtml_Block_Dashboard_Orders_Grid::_prepareCollection()

    Replace joinCustomerName with joinCustomerBillingName

  2. Mage_Reports_Model_Resource_Order_Collection

    Add function:

    public function joinCustomerBillingName($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;
    }
    

    Source

| improve this answer | |
  • Where is the file to change? I know you mentioned not editing the core file (and I agree 100%). Thus, I believe I need to make a copy of the file and put it in a new location so if you could provide the original filename (with full path) and the path to the new location it would be tremendously helpful. – Charles Wilkins IV Oct 1 '15 at 18:38
  • The local path would be app/code/local/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php. However, instead of copying the entire file, which would still make it "immune" to upgrades, I'd encourage you to extend it and only edit the function(s) you need to. There's a good article, here. – WackGet Oct 2 '15 at 3:36
  • In v1.9.3.0 and possibly earlier: When extending Mage_Adminhtml_Block_Dashboard_Orders_Grid::_prepareCollection(), you must also change the return to: return Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection(); or the Grid will not be populated using your changes. – TomWilsonFL Dec 30 '16 at 21:01
  • If your order links stop working from the Dashboard grid, this line in the above function needs to be changed: $this->getSelect()->join(array('t2' => 'sales_flat_order_address'),'main_table.billing_address_id = t2.entity_id', array())->columns(array($alias => $fieldConcat)); – TomWilsonFL Dec 30 '16 at 21:18
  • Finally, if you use table prefixes in your DB, then remember to change sales_flat_order_address in the above given function to prefix_sales_flat_order_address. – TomWilsonFL Dec 30 '16 at 21:19

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.