Magento2 Error: “Something went wrong with processing the default view and we have restored the filter to its original state” showing on the loop
-
12-05-2021 - |
Question
Whenever I open the Catalog Product it gives the following error on loop and continue loading the loader
Attention Something went wrong.
Something went wrong with processing the default view and we have restored the filter to its original state.
I tried clear the cache(php bin/magento cache:clean)
also upgraded magento(php bin/magento setup:upgrade)
even given the files and folder permission but still facing the same problem.
Solution
Old post but for future viewers - a temporary fix is to clear (empty, not delete) the ui_bookmark table of your magento 2 database, this will reset the grid back to it's default and stop the infinite load.
(you can find out your admin user ID in the admin_users table as well and only remove the ui_bookmark rows relevant to your account if this is a multi-admin site)
The actual problem can be harder to diagnose, but a good place to start (and in my case) was to increase the php timeout limit.
OTHER TIPS
In My Case, It was due to that some null SKU related error I resolved using the following query.
UPDATE catalog_product_entity SET sku='' WHERE sku IS NULL;
run SELECT * FROM catalog_product_entity
WHERE sku
IS NULL to check all product not have sku, then update them
Sometimes, this error is made by version upgrade. In my case, I upgraded Magento 2.2.7 to 2.3.1 and then I got this error in the product grid panel of backend. So I checked "catalog_product_entity" table in the database. There were several products with NULL as sku value. I made those skus empty and the error went away!!! I hope this will be helpful for you.
This commit can solve your problem.
https://github.com/magento/magento2/pull/14905
Magento/Framework/View/Element/UiComponent/DataProvider/FulltextFilter.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View\Element\UiComponent\DataProvider;
use Magento\Framework\Data\Collection;
use Magento\Framework\Data\Collection\AbstractDb;
use Magento\Framework\Api\Filter;
/**
* Class Fulltext
*/
class FulltextFilter implements FilterApplierInterface
{
/**
* Returns list of columns from fulltext index (doesn't support more then one FTI per table)
*
* @param AbstractDb $collection
* @param string $indexTable
* @return array
*/
protected function getFulltextIndexColumns(AbstractDb $collection, $indexTable)
{
$indexes = $collection->getConnection()->getIndexList($indexTable);
foreach ($indexes as $index) {
if (strtoupper($index['INDEX_TYPE']) == 'FULLTEXT') {
return $index['COLUMNS_LIST'];
}
}
return [];
}
/**
* Add table alias to columns
*
* @param array $columns
* @param AbstractDb $collection
* @param string $indexTable
* @return array
*/
protected function addTableAliasToColumns(array $columns, AbstractDb $collection, $indexTable)
{
$alias = '';
foreach ($collection->getSelect()->getPart('from') as $tableAlias => $data) {
if ($indexTable == $data['tableName']) {
$alias = $tableAlias;
break;
}
}
if ($alias) {
$columns = array_map(
function ($column) use ($alias) {
return '`' . $alias . '`.' . $column;
},
$columns
);
}
return $columns;
}
/**
* Escape against value
* @param string $value
* @return string
*/
private function escapeAgainstValue(string $value): string
{
return preg_replace('/([+\-><\(\)~*\"@]+)/', ' ', $value);
}
/**
* Apply fulltext filters
*
* @param Collection $collection
* @param Filter $filter
* @return void
*/
public function apply(Collection $collection, Filter $filter)
{
if (!$collection instanceof AbstractDb) {
throw new \InvalidArgumentException('Database collection required.');
}
/** @var SearchResult $collection */
$mainTable = $collection->getMainTable();
$columns = $this->getFulltextIndexColumns($collection, $mainTable);
if (!$columns) {
return;
}
$columns = $this->addTableAliasToColumns($columns, $collection, $mainTable);
$collection->getSelect()
->where(
'MATCH(' . implode(',', $columns) . ') AGAINST(?)',
$this->escapeAgainstValue($filter->getValue())
);
}
}
File open:
\vendor\magento\framework\View\Element\UiComponent\DataProvider\FulltextFilter.php
Function change:
public function apply(Collection $collection, Filter $filter)
{
if (!$collection instanceof AbstractDb) {
throw new \InvalidArgumentException('Database collection required.');
}
/** @var SearchResult $collection */
$mainTable = $collection->getMainTable();
$columns = $this->getFulltextIndexColumns($collection, $mainTable);
if (!$columns) {
return;
}
$columns = $this->addTableAliasToColumns($columns, $collection, $mainTable);
$collection->getSelect()
->where(
'MATCH(' . implode(',', $columns) . ') AGAINST(?)',
// $filter->getValue()
$this->escapeAgainstValue($filter->getValue())
);
}
None of the above worked for me. What solved the problem for me is related to the admin user roles configuration as described in this article: https://medium.com/@teacha/magento-2-something-went-wrong-with-processing-the-default-view-and-we-have-restored-the-filter-9e2810733e71
When I provide all access to the orders section, the problem was solved. When access is partial, this error may appear. It's not ideal, especially if some users shouldn't have accesss to certains of the admin order page, but this is good solution for me until the bug is fixed by Magento.