-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manual sort gets set back to automatic sort #2948
Comments
Hello @mstoiber, We have already encountered similar problems and each time it is very difficult to reproduce them in a standard environment. Therefore, we need more information. You can specify in what time interval the sorting changed back, within a few minutes or hours, or maybe days. Maybe you can provide more detailed steps for reproducing, with a mention of how exactly you do it. BR, |
Hello, thanks for the reply! It is also very difficult to reproduce for us. For reproduction of the error, I changed the sorting order multiple times and saved it, also sometimes I just changed a few items to automatic sort myself. After some tries, the occurred. |
Are there any news on this topic? I figured out that in all the previous request I had about 410 items in the productPositions Array But suddenly there were only 95. I checked the payload that was sent to the server and there were only 95 items in there, so there must be a problem with the javascript. I'will try to investigate that further and it would be highly appreciated if you @vahonc could also take a look into this problem. |
@vahonc I figured out that this is not a JS-Related issue. The issue possibly lies within Elasticsearch or PHP. When loading the Category Page I debugged how many manually sorted products get posted to the preview controller \Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview Most of the time everything is ok, but sometimes it happens that the $responseData from the getPreviewObject() in the execute function returns a significantly lower amount of products. And this is what causes the problem. I tried to call the preview with xhr request (to eliminate Magento JS-logic) and also while indexing Elasticsearch, but I was not able to reproduce the behavior consistently. |
Same here, but it is really hard to reproduce. One possibility is that when jsonDecode throws an exception private function unserializeProductPositions(\Magento\Catalog\Model\Category $category)
{
$productPositions = $category->getSortedProducts() ? $category->getSortedProducts() : [];
if (is_string($productPositions)) {
try {
$productPositions = $this->jsonHelper->jsonDecode($productPositions);
} catch (\Exception $e) {
$productPositions = []; // This will reset products on exception
}
}
$category->setSortedProducts($productPositions);
return $this;
} |
We've incurred in a similar issue when upgrading from Magento 2.4.3-p3 with Elasticsuite 2.10, to Magento 2.4.6-p3 with Elasticsuite 2.11. |
Having a similar issue with a client trying to manually sort around 100 product items within their sale category. Every so often the sale category will randomly revert back to automatic sort clearing the manual sort positions. The only solution we've been able to offer is to just persist with reconfiguring the manual sorting positions, this isn't ideal as it takes a fair amount of time to reconfigure 100+ product positions. Not that this has any definitive basis but could this issue be due to the quantity of product items being manually sorted within a category? Our client doesn't experience this issue on any other category where they manually sort a smaller collection of product items whereas in their sale category, they sort 100+ products with manual positioning. Magento Version: 2.4.5-p7 |
@MTheProgrammer is right, this occurs when truncated data get sent to the backend. As a security mechanism, @vahonc can you implement the following : Instead of setting the array to empty, just fallback to the previously existing list of Products. Maybe the existing list is in And add a warning message saying something like "Something went wrong while saving your product positions, they have been switched back to their last known state". Regards |
…ck-to-last-valid-product-positions-2.10-fix [Catalog] Fix #2948 fallback to the last known valid product positions
Our customer has a problem where when they change the sort order and/or change some products back to automatic search many products automatically get set back to automatic sort only some remain in manual sort.
We found out that a reload of the site may change it back.
Also sometimes after rearranging the sort order, the category does not show all products.
Environment
Magento Version: 2.4.5-p1
ElasticSuite Version: 2.10.15.1
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: