-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Wrong sorting of products in taxon after saving #15954
Comments
Hi @delyriand, |
Hi @jakubtobiasz, I can't reproduce the -1 positions… But if you look at the "maxPosition" (via xdebug or similar) when saving product positions in Jeans taxon, you'll see that it's 5 but not 7. And if you try to save these positions: I should have:
Products are saved in the wrong order: Does it help you reproduce my issue? |
Hi @delyriand! Thank you for raising the issue! 🏅 |
Sylius version affected: 1.2.11 and higher
Description
The position of the last products in a taxon is not correctly saved when there are more products than the taxon of the 1st productTaxon.
Because the
getMaxPosition
method inSylius\Bundle\CoreBundle\Controller\ProductTaxonController
class returns the wrong maximum position.This is because when we load the "productTaxon" via the line
$productTaxon = $this->findOr404($configuration);
we have no criteria. So theSingleResourceProvider
does afindOneBy
with an empty array and returns the 1st "productTaxon".Steps to reproduce
/admin/products/taxon/9
Possible Solution
We could define the criteria in the
requestConfiguration
before calling thegetMaxPosition
method. For example:The text was updated successfully, but these errors were encountered: