init
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Stemcell\Sales\Model\ResourceModel\Order\Grid;
|
||||
|
||||
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
|
||||
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
|
||||
use Magento\Framework\Event\ManagerInterface as EventManager;
|
||||
use Magento\Sales\Model\ResourceModel\Order\Grid\Collection as OriginalCollection;
|
||||
use Psr\Log\LoggerInterface as Logger;
|
||||
use Stemcell\Customer\Model\ResourceModel\Salesperson as SalespersonResource;
|
||||
|
||||
/**
|
||||
* Order grid extended collection
|
||||
*/
|
||||
class Collection extends OriginalCollection
|
||||
{
|
||||
protected $helper;
|
||||
|
||||
public function __construct(
|
||||
EntityFactory $entityFactory,
|
||||
Logger $logger,
|
||||
FetchStrategy $fetchStrategy,
|
||||
EventManager $eventManager,
|
||||
$mainTable = 'sales_order_grid',
|
||||
$resourceModel = \Magento\Sales\Model\ResourceModel\Order::class
|
||||
)
|
||||
{
|
||||
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
|
||||
}
|
||||
|
||||
protected function _renderFiltersBefore()
|
||||
{
|
||||
$salespersonTable = $this->getTable('salesperson');
|
||||
$this->getSelect()
|
||||
->joinLeft($salespersonTable, 'salesperson.salesperson_id = sales_order.salesperson_id', ['salesperson_name'=>'salesperson.name']);
|
||||
|
||||
parent::_renderFiltersBefore();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user