我使用HWG Attribute Manager向客户添加自定义属性。即IDNumber。
http://www.magentocommerce.com/magento-connect/custom-attributes-4340.html
因此,如果客户订单,在管理员的订单网格中,我想获得此属性。我这样做有问题。有人曾尝试过这个吗?
添加的属性位于数据库中的customer_entity_varchar
中。
我试过了,
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('customer/customer_collection')
->addNameToSelect()
->addAttributeToSelect('email')
->addAttributeToSelect('created_at')
->addAttributeToSelect('group_id')
->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');
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('entity_id', array(
'header' => Mage::helper('customer')->__('ID'),
'width' => '50px',
'index' => 'entity_id',
'type' => 'number',
));
$this->addColumn('Admin Number', array(
'header' => Mage::helper('customer')->__('Admin Number'),
'width' => '100',
'index' => 'entity_id',
));
答案 0 :(得分:0)
我解决了。这只是我的错误。
这将有效:
->addAttributeToSelect('my_custom_customer_attribute_name')