Sales order view page, we have added some custom columns, but filters are not working. Please, check below screen-shot.
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Custom\Sales\Model\ResourceModel\Order\Grid;
use Magento\Sales\Model\ResourceModel\Order\Grid\Collection as OriginalCollection;
/**
* Order grid extended collection
*/
class Collection extends OriginalCollection {
protected function _initSelect() {
parent::_initSelect();
$this->getSelect()->joinLeft(
['sales_order_item' => $this->getTable('sales_order_item')], //2nd table name by which you want to join mail table
'main_table.entity_id = sales_order_item.order_id',
['CONCAT(sales_order_item.name,"(",sales_order_item.sku,")") as pname']
);
$this->getSelect()->joinLeft(
['sales_order' => $this->getTable('sales_order')],
'main_table.entity_id = sales_order.entity_id', ['user_id']
)->group('main_table.entity_id');
}
}
List of column
sku,user_id,status,warehouse_id,customer_id,increment_id,base_grand_total,grand_total,store_id
What could be reason behind it?
Thanks in advance