我希望将所有客户地址属性加入到完整的客户集合中。
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
$collection->joinField('is_active', 'customer/address', 'is_active','parent_id=entity_id');
给了我致命的错误:
Mage_Core_Exception: Can't retrieve entity config: customer/address in /app/Mage.php on line 563
由于我使用的是Enterprise,我们可以添加客户地址属性,因此使用加入特定地址属性的方法并不令人满意,如下代码片段:
$collection->addNameToSelect()
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
->joinAttribute('billing_telephone', 'customer_address/telephone', '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')
有任何想法吗?谢谢你。