File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
app/code/Magento/Catalog/Model/ResourceModel/Product Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2182,12 +2182,17 @@ public function addMediaGalleryData()
2182
2182
2183
2183
$ mediaGalleries = [];
2184
2184
$ linkField = $ this ->getMetadataPool ()->getMetadata (ProductInterface::class)->getLinkField ();
2185
+ $ items = $ this ->getItems ();
2186
+
2187
+ $ select ->where ('entity. ' . $ linkField . ' IN (?) ' , array_map (function ($ item ) {
2188
+ return $ item ->getId ();
2189
+ }, $ items ));
2185
2190
2186
2191
foreach ($ this ->getConnection ()->fetchAll ($ select ) as $ row ) {
2187
2192
$ mediaGalleries [$ row [$ linkField ]][] = $ row ;
2188
2193
}
2189
2194
2190
- foreach ($ this -> getItems () as $ item ) {
2195
+ foreach ($ items as $ item ) {
2191
2196
$ mediaEntries = isset ($ mediaGalleries [$ item ->getId ()]) ? $ mediaGalleries [$ item ->getId ()] : [];
2192
2197
$ this ->getGalleryReadHandler ()->addMediaDataToProduct ($ item , $ mediaEntries );
2193
2198
}
You can’t perform that action at this time.
0 commit comments