craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 637 forks source link

[5.x]: Can't move the last variant in the variant list #16103

Closed WHITE-developer closed 1 week ago

WHITE-developer commented 1 week ago

What happened?

Description

We have an product with more then 50 variants but when we we want to reorder the last variant of the page we get an JavaScript error. Maybe related to: https://github.com/craftcms/cms/issues/16026

Steps to reproduce

  1. Create a product.
  2. Add more than 50 variants to the product (e.g., 55 variants).
  3. move the last variant

Expected behavior

The variant should be at the position it’s dragged to. Reordering should work consistently, allowing users to adjust the order of the variants.

Actual behavior

The variant won't reorder and we get an JavaScript error in the console: Uncaught (in promise) ye {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …} We can't reorder any other variants. I tried to move the last variant 3 times and get the same error 3 times: Image

Craft CMS version

5.4.10

PHP version

8.3.8

Operating system and version

No response

Database type and version

MySQL 8.0.37

Image driver and version

No response

Installed plugins and versions

-Commerce: 5.x-dev

i-just commented 1 week ago

Hi, thanks for reporting! I raised a PR for this.

WHITE-developer commented 1 week ago

We also have a different problem when I move an disabled variant: Image And save the page with "ctrl" + "s" the whole layout of variants changes: Image In the first image, we initially had two disabled products stacked above each other, with our moved variant positioned below them. However, after saving the page, the arrangement changed. Now, either:

i-just commented 1 week ago

Thanks! That’s a separate issue, and it only affects Commerce variants, so I raised it in the Commerce repo (along with a PR).

brandonkelly commented 1 week ago

Craft 5.5.1 is out with that original fix. Thanks again!