diff --git a/app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php b/app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php index 743bc83588296..c306998e96fb0 100644 --- a/app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php +++ b/app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php @@ -55,7 +55,7 @@ public function aroundAddFieldToFilter( } } - $fieldName = $subject->getConnection()->quoteIdentifier($field); + $fieldName = $subject->getConnection()->quoteIdentifier('main_table.' . $field); $condition = $subject->getConnection()->prepareSqlCondition($fieldName, $condition); $subject->getSelect()->where($condition, null, Select::TYPE_CONDITION); diff --git a/app/code/Magento/Sales/etc/adminhtml/di.xml b/app/code/Magento/Sales/etc/adminhtml/di.xml index 7ea46d60caeec..65fb65b87529a 100644 --- a/app/code/Magento/Sales/etc/adminhtml/di.xml +++ b/app/code/Magento/Sales/etc/adminhtml/di.xml @@ -49,9 +49,18 @@ - + + + + + + + + + + \Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory diff --git a/dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php b/dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php index 718a5f67bb714..d8122fc05788a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php @@ -80,10 +80,10 @@ public function testAroundAddFieldToFilter($mainTable, $resourceModel, $field, $ if ($mainTable == 'sales_order_grid') { $condition = ['from' => $fieldValue , 'locale' => "en_US", 'datetime' => true]; - $selectCondition = "WHERE (`{$field}` >= '{$convertedDate}')"; + $selectCondition = "WHERE (`main_table`.`{$field}` >= '{$convertedDate}')"; } else { $condition = ['qteq' => $fieldValue]; - $selectCondition = "WHERE (((`{$field}` = '{$convertedDate}')))"; + $selectCondition = "WHERE (((`main_table`.`{$field}` = '{$convertedDate}')))"; } $this->searchResult = $this->objectManager->create(