Closed ghost closed 3 years ago
Above PR was me, was in the process of switching accounts, sorry!
Hi everyone!
Is there an ETA on when this PR will be merged into master?
We encountered the same issue as this: https://github.com/markshust/magento2-module-ordergrid/issues/8 where columns in select don't have 'main_table' alias assigned to it, hence using filters fails with this error for example:
.CRITICAL: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous
We can always apply a patch to either extend the original class, or to just add this bit in '_initSelect':
$tableDescription = $this->getConnection()->describeTable($this->getMainTable());
foreach ($tableDescription as $columnInfo) {
$this->addFilterToMap($columnInfo['COLUMN_NAME'], 'main_table.' . $columnInfo['COLUMN_NAME']);
}
But I assume that cleanest solution would be to resolve this inside the module.
Thanks and best regards!
Is there an ETA on when this PR will be merged into master?
I think @markshust would be best to answer that 😅
@robaimes @roby0404 so sorry on the delay of this! I tested it and everything seems to work properly. Merging in. Thanks!
Fixes #8
The re-definition of the collection in
di.xml
can prevent third party modules (and even some commerce modules) from displaying or filtering values correctly.Ideally the default collection source shouldn't be replaced as it currently is in
di.xml
and everything should be done via plugin(s) to prevent overriding the default collection. I attempted to use plugins but would sadly require further work.For now, changing the
MarkShust\OrderGrid\Model\ResourceModel\Order\Grid\Collection
class to extend the default class defined in the sales module, means that any other modules that add filtering and columns now work correctly, since the plugins they add to the default class now also process correctly from the parent.