I am using magento 2.3.1.
I am having this strange issue only in admin>customer grid
No matter which column I choose to sort the results are always the same.
It happens only in this grid.
What I tried:
- reindex all indexers, several times
- checked Redis conf, removed, reinstalled again
- Checked Opcache settings, disabled and enabled back
- Used nginx standalone, used Nginx as proxy pass with Apache
- Reboot server several time
- Magento caches are disabled, recleared several times, recopliled and redeploy
- Cleared ui_bookmark table
Nothing from these helped. The only thing I noticed is that on local server with apache only it works with no problem.
Also when this started, when I tried to install a new module, although module was istalled fine, upgraded and compiled when I went to admin I couldn't find it anywhere.
Again in local wasn't this problem. I think that these two are related.
UPDATE
After making some operations to server and needed to restart all services like Nginx, php-fpm, Redis, varnish, elastic magento customer grid started to work fine again.
But after working in admin about 2 days again the customer grid isn't sorting.
I am sure that is definitely some cache problem....Something is caching this particular grid....I am using Redis 5. Maybe I switch to 4?
Any help or ideas will be appreciated!
1 Answer 1
Faced the same problem in Magento 2.2.8.
The problem is that the controller returns the same results, sorted by ID (or not, not sure).
After digging into this I found out that a problem in this file:
vendor/magento/module-customer/Model/GroupManagement.php
Inside getLoggedInGroups method:
$groupNameSortOrder = $this->sortOrderBuilder
->setField('customer_group_code')
->setAscendingDirection()
->create();
Here, the sort is always set to AscendingDirection (setAscendingDirection) and after setting this sorting to search criteria ->addSortOrder($ groupNameSortOrder)
I fixed this temporarily by simply overriding this file and deleting the line with ->addSortOrder($ groupNameSortOrder)
Small guide:
Create new module.
File: app/code/VENDOR/MODULE/etc/adminhtml/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <!-- Customer Admin Grid Sorting fix --> <preference for="Magento\Customer\Model\GroupManagement" type="VENDOR\MODULE\Model\Customer\GroupManagement" /> </config>File: app/code/VENDOR/MODULE/Model/Customer/GroupManagement.php
filterBuilder ->setField(GroupInterface::ID) ->setConditionType('neq') ->setValue(self::NOT_LOGGED_IN_ID) ->create(); $groupAll[] = $this->filterBuilder ->setField(GroupInterface::ID) ->setConditionType('neq') ->setValue(self::CUST_GROUP_ALL) ->create(); $searchCriteria = $this->searchCriteriaBuilder ->addFilters($notLoggedInFilter) ->addFilters($groupAll) ->create(); return $this->groupRepository->getList($searchCriteria)->getItems(); } }
-
Thank you! But it isn't working for me....Tried with module and directly to core file...No luck. @Игорь Колчин are you sure it fixed for you?G. G.– G. G.2019年04月24日 13:36:32 +00:00Commented Apr 24, 2019 at 13:36
-
Yes. Have you tried to run commands from cli: bin/magento setup:upgrade and bin/magento setup:di:compile ? You can check which results returns magento in devtools: prnt.sc/ngc0mw Do both requests return the same data, or they are different and sorted?Igosyee– Igosyee2019年04月24日 15:58:16 +00:00Commented Apr 24, 2019 at 15:58
-
I run upgrade and compile....it didn't help...Also in network when I sort I don't have your screen. I only have one ?namespace=customer request. Above I have only ?isAjax=true with empty results. If I refresh the page I get the two requests. Then when try to sort I get again only one request and empty AjaxG. G.– G. G.2019年04月24日 18:45:14 +00:00Commented Apr 24, 2019 at 18:45
-
Try to sort different column. For example sort column with emails twice and check requestsIgosyee– Igosyee2019年04月25日 09:34:52 +00:00Commented Apr 25, 2019 at 9:34
-
all columns have same result....Nothing is changing....Also I tried to remove some of them...Problem still thereG. G.– G. G.2019年04月25日 11:57:09 +00:00Commented Apr 25, 2019 at 11:57
Explore related questions
See similar questions with these tags.
http://example.com/admin/mui/index/render/key/a70f1877ef4497ab4d91b261bdc84e59fd55cfa9c4477de093b6585044aeda24/?namespace=customer_listing&search=&filters%5Bplaceholder%5D=true&paging%5BpageSize%5D=100&paging%5Bcurrent%5D=1&sorting%5Bfield%5D=entity_id&sorting%5Bdirection%5D=desc&isAjax=trueandhttp://example.com/admin/mui/bookmark/save/key/cebf3f2d676c37e2259d0e4964b2d5daf27620c32e8010e7e255929dd375cb05/?isAjax=trueGET and POST. These only the first time I press in column sort....If I press again I get no data in network.