0
Я использую следующий код, чтобы включить пользовательский атрибут, под названием «отдел продаж» в рамках фактурной сетки Magento:Magento фильтр счета-фактура сетка объединенных значением атрибута
protected function _prepareCollection() {
$sales_rep = Mage::getResourceSingleton('customer/customer')->getAttribute('sales_rep');
$collection = Mage::getResourceModel('sales/order_invoice_grid_collection');
$collection->join('invoice', 'main_table.entity_id = invoice.entity_id',array('order_id as order_id'));
$collection->join('order', 'invoice.order_id = order.entity_id',array('customer_id as customer_id'));
$collection->getSelect()->joinLeft(
array('customer_sales_rep_table' => Mage::getSingleton('core/resource')->getTableName($sales_rep->getBackend()->getTable())),
'customer_sales_rep_table.entity_id = order.customer_id
AND customer_sales_rep_table.attribute_id = '.(int) $sales_rep->getAttributeId() . '
',
array('sales_rep'=>'value')
);
$this->setCollection($collection);
return parent::_prepareCollection();
}
...
$this->addColumn('sales_rep', array(
'header' => Mage::helper('sales')->__('Sales Rep'),
'index' => 'sales_rep',
'filter' => false
));
Это прекрасно работает, до тех пор, пока свойство «addColumn» «filter» установлено на «false».
Как я могу позволить пользователям фильтровать этот объединенный атрибут?