所有客户名单

List of all customers

我想在我正在构建的自定义模块中创建所有客户的列表,但我似乎无法找出问题所在。我试过这个:

 public function getAllOptions($withEmpty = true, $defaultValues = false)
    {
    $source  = Mage::getModel('eav/config')->getAttribute('customer', 'firstname');
    return $source->getSource()->getAllOptions($withEmpty, $defaultValues);
}

但是它给我一个错误:

Source model "" not found for attribute "firstname"

#0 /var/www/c8do/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(387): Mage::exception('Mage_Eav', 'Source model ""...')

当我尝试用性别替换名字时,它工作正常(给出 female/male)。

$collection = Mage::getModel('customer/customer')->getCollection()
   ->addAttributeToSelect('firstname')
   ->addAttributeToSelect('lastname')
   ->addAttributeToSelect('email');

如果您不需要名字、姓氏或电子邮件,您可以跳过此行。