Open madranet opened 5 years ago
I can confirm that there is a bug - if you upload multiple images by drag & drop and immediately reorder them, in the web console you can see that an AJAX call to /reorder
endpoint fails with error:
{"error": {"ordered_images": ["This field is required."]}}
@madranet Could you confirm that this is happening only if you reorder images (immediately after drag & drop upload) without refreshing product image gallery page?
I think the problem is in sortable.js
. It is looking for sortable-items
on page, but before refreshing (after drag & drop upload) there are none.
https://github.com/mirumee/saleor/blob/a169db84b3fade10edf5c86564139adf4e3f252a/saleor/static/dashboard/js/components/sortable.js#L10
Before refreshing the items in image gallery have li class:
col s12 m6 l4 product-gallery-item dz-preview dz-processing dz-image-preview dz-success dz-complete
and after refreshing:
col s12 m6 l4 sortable-item
What I'm trying to achieve
Upload product images and put in certain order …
Steps to reproduce the problem
What I expected to happen
Image order in Editor should reflect image order on product page …
When I drag multiple images into the Edit Images window and then view the product in my shop, the images are not in the same order as they are displayed in the Edit Images window. I have to go back to the Edit Images window and rearrange the images by dragging them round –even if I end up putting them back in the same order they were originally– before the shop view will honour the order in the Edit Images window. Sometimes I have to do this a couple of times before the image order in the shop follows the image order in the Edit Images window.
Screenshots
1: Add new product and open 'Edit Images' screen:
2: Drag in multiple images [note the order]:
3: Preview product in shop [note image order is different]:
4: Return to 'Edit Images' screen and drag images around to rearrange them –eventually putting them back into their original order:
5: Now preview product again [Images are now in the correct order]:
System information Operating system: OSX [test version running locally] Browser: Yandex.