Closed RishabhRkRai closed 7 years ago
How exactly is this Magento 2 issue?
Closing this issue as this relates to custom code written by you and not Magento's. You might have more luck asking for help in the Magento forums or on StackExchange.
Error when filtering orders in the Admin
Issue Filtering orders in the Admin by date returns an error.
The exception.log shows:
report.CRITICAL: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous in /path/to/magento/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:90 CopyToggle Text Wrapping Steps to reproduce:
Go to Admin > Sales > Orders.
Set Purchase Date Ascending order in grid, OR Set Purchase Date Filter in filters. An error appears: Something went wrong with processing the default view and we have restored the filter to its original state.
Cause There is an issue with the PayPal Braintree modules.
Solution To solve the issue, apply the patch attached to this article. To download it, scroll down to the end of the article and click the file name, or click the following link:
bundle_3357_filter_order_in_admin_by_date_patch.zip
The patch is compatible with all affected versions and editions.
How to apply the patch For instructions, see How to apply a composer patch provided by Adobe in the support knowledge base.
Preconditions
Steps to reproduce
view/adminhtml/ui-component/sales_order_grid.xml `
and AddColumnsSalesOrderGridCollection.php
public function aroundGetReport( \Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory $subject, \Closure $proceed, $requestName ) { $result = $proceed($requestName); if ($requestName == 'sales_order_grid_data_source') { if ($result instanceof $collection) { $collection->getSelect()->join( ["soi" => "sales_order_item"], 'main_table.entity_id = soi.order_id', ['sku' => 'GROUP_CONCAT(DISTINCT soi.sku)', 'name' => 'GROUP_CONCAT(DISTINCT soi.name)' ] )->join( ["soa" => "sales_order_address"], 'main_table.entity_id = soa.parent_id', ['country_id' => 'soa.country_id'] )->group("soa.parent_id"); } return $collection; } }
Expected result
Actual result