Search code examples
magentoentity-attribute-valuemagento-1.4

Magento - get the company name of a registred customer


I use this code:

$customerCollection = Mage::getResourceModel('customer/customer_collection')
->addNameToSelect()
->addAttributeToSelect('email')
->joinAttribute('postcode', 'customer_address/company', 'default_billing', null, 'left')
->joinAttribute('postcode', 'customer_address/postcode', 'default_billing', null, 'left')          
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');

How can I also get the company name of a registred customer ??

Thanks.


Solution

  • check if the attribute name is really "company"

    joinAttribute('company', 'customer_address/company', 'default_billing', null, 'left')