Magento Forum

   
Displaying Company Name in customer grid in CE 1.7.0.2
 
SafariYellow
Jr. Member
 
Total Posts:  27
Joined:  2010-05-24
 

I am trying to add the customers Company Name to the customer grid (Manage Customers) in the admin portal. In /app/code/core/Mage/Adminhtml/Block/Customer/Grid.php I have added the following code:

In the _prepareCollection() function I have added this line to the collection:

->joinAttribute('billing_company''customer_address/company''default_billing'null'left')

And in the _prepareColumns() function I have added this code to create the new column:

$this->addColumn('company', array(
    
'header'    => Mage::helper('customer')->__('Company'),
    
'index'     => 'billing_company'
));

The new “Company” column appears in the grid but the value is empty for every customer - no errors being thrown anywhere.

This works on other versions of Magento but not on CE 1.7.0.2??

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Add in _prepareCollection() method this line among the others:

->addAttributeToSelect('company')

Cheers,
Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SafariYellow
Jr. Member
 
Total Posts:  27
Joined:  2010-05-24
 
tzyganu - 13 September 2012 06:57 AM

Add in _prepareCollection() method this line among the others:

->addAttributeToSelect('company')

Cheers,
Marius.

Thanks Marius - looks like that did the trick!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bydusk
Jr. Member
 
Total Posts:  7
Joined:  2011-08-08
 

After this changes my column \"Company\" still blank :( , any idea ?

Many Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
SafariYellow
Jr. Member
 
Total Posts:  27
Joined:  2010-05-24
 
bydusk - 25 October 2012 02:27 AM

After this changes my column \"Company\" still blank :( , any idea ?

Many Thanks

bydusk - do you have any extensions that might be overwriting the core customer grid?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bydusk
Jr. Member
 
Total Posts:  7
Joined:  2011-08-08
 

SafariYellow I have installes \"Customer Attributes\” extension from Amasty, you think this overwrite my customer grid ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SafariYellow
Jr. Member
 
Total Posts:  27
Joined:  2010-05-24
 
bydusk - 31 October 2012 11:31 PM

SafariYellow I have installes \"Customer Attributes\” extension from Amasty, you think this overwrite my customer grid ?

Yes, that is almost definitely overwriting the customer grid. You should be able to see the Amasty version of the Grid.php file here: /app/code/local/Amasty/Customerattr/Block/Rewrite/Customer

Amasty support may be able to help you out if that is where the problem is.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bydusk
Jr. Member
 
Total Posts:  7
Joined:  2011-08-08
 

After adding

->joinAttribute('billing_company''customer_address/company''default_billing'null'left')
to this file company names is visible in magento admin panel.

Many Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kaushik Patel
Jr. Member
 
Total Posts:  28
Joined:  2011-12-24
 

Try this work like a charm…
http://hkpatel201.blogspot.in/2013/02/add-company-column-in-customer-grid.html

thanks....

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top