在网格菜单中添加列选择过滤器
我试图在“源”列中添加选择以允许过滤,所有这些代码都运行良好,但我试图添加过滤器但没有成功,任何人都可以指出我正确的方向吗?
直到知道我有:
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('source', 'customer/source', 'default_billing', null, 'left')
->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');
$this->setCollection($collection);
return parent::_prepareCollection();
}
并且
$this->addColumn('source', array(
'header' => Mage::helper('customer')->__('Source'),
'type' => 'source',
'index' => 'source'
));
非常感谢任何帮助 谢谢
I’m trying to add select in my column “Sources” to allow filter, all this code works well, but I’m trying to add filter without any success, anyone can point me in the right direction?
Until know I have:
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('source', 'customer/source', 'default_billing', null, 'left')
->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');
$this->setCollection($collection);
return parent::_prepareCollection();
}
and
$this->addColumn('source', array(
'header' => Mage::helper('customer')->__('Source'),
'type' => 'source',
'index' => 'source'
));
Any help will be very apreciated
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
类型值不应该是
source
。那没有任何作用。它必须是app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/
中的类之一。The type value should not be
source
. That doesn't do anything. It needs to be one of the classes inapp/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/
.