File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
CatalogImportExport/Model/Import Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,11 @@ public function __construct(
55
55
public function execute (Observer $ observer )
56
56
{
57
57
$ mediaGalleryEntriesChanged = $ observer ->getEvent ()->getMediaGallery ();
58
+ $ mediaGalleryLabelsChanged = $ observer ->getEvent ()->getMediaGalleryLabels ();
58
59
59
- if (empty ($ mediaGalleryEntriesChanged )) {
60
+ if (empty ($ mediaGalleryEntriesChanged ) &&
61
+ empty ($ mediaGalleryLabelsChanged )
62
+ ) {
60
63
return ;
61
64
}
62
65
@@ -66,7 +69,11 @@ public function execute(Observer $observer)
66
69
$ productSkusToInvalidate [] = array_keys ($ productSkus );
67
70
}
68
71
69
- $ productSkusToInvalidate = array_merge (...$ productSkusToInvalidate );
72
+ foreach ($ mediaGalleryLabelsChanged as $ label ) {
73
+ $ productSkusToInvalidate [] = [$ label ['imageData ' ]['sku ' ]];
74
+ }
75
+
76
+ $ productSkusToInvalidate = array_unique (array_merge (...$ productSkusToInvalidate ));
70
77
$ products = $ this ->productRepository ->getList (
71
78
$ this ->criteriaBuilder ->addFilter ('sku ' , $ productSkusToInvalidate , 'in ' )->create ()
72
79
)->getItems ();
Original file line number Diff line number Diff line change @@ -1694,7 +1694,12 @@ protected function _saveProducts()
1694
1694
$ this ->_saveProductAttributes ($ attributes );
1695
1695
$ this ->_eventManager ->dispatch (
1696
1696
'catalog_product_import_bunch_save_after ' ,
1697
- ['adapter ' => $ this , 'bunch ' => $ bunch , 'media_gallery ' => $ mediaGallery ]
1697
+ [
1698
+ 'adapter ' => $ this ,
1699
+ 'bunch ' => $ bunch ,
1700
+ 'media_gallery ' => $ mediaGallery ,
1701
+ 'media_gallery_labels ' => $ labelsForUpdate ,
1702
+ ]
1698
1703
);
1699
1704
}
1700
1705
return $ this ;
You can’t perform that action at this time.
0 commit comments