File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Service/ProductData/AttributeCollector/Data Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -172,13 +172,22 @@ private function combineData(array $imagesData, array $typesData): array
172172 $ position = $ imageData ['position ' ];
173173 $ imageValue = $ imageData ['value ' ];
174174
175- $ result [$ entityId ][$ storeId ][$ position ] = [
175+ $ result [$ entityId ][$ storeId ][] = [
176176 'file ' => $ this ->getMediaUrl ('catalog/product ' . $ imageValue ),
177177 'position ' => $ position ,
178178 'types ' => $ typesData [$ entityId ][$ imageValue ][$ storeId ] ?? []
179179 ];
180180 }
181181
182+ // Sort by position ascending
183+ foreach ($ result as &$ stores ) {
184+ foreach ($ stores as &$ images ) {
185+ usort ($ images , function ($ a , $ b ) {
186+ return (int )$ a ['position ' ] <=> (int )$ b ['position ' ];
187+ });
188+ }
189+ }
190+
182191 return $ result ;
183192 }
184193 /**
You can’t perform that action at this time.
0 commit comments