You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 in Sylius\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 the SingleResourceProvider does a findOneBy with an empty array and returns the 1st "productTaxon".
Steps to reproduce
with the default fixutres
try to reorder all products in the Jeans taxon /admin/products/taxon/9
position of 2 last product is "-1"
Possible Solution
We could define the criteria in the requestConfiguration before calling the getMaxPosition method. For example:
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.
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: