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(
5555 public function execute (Observer $ observer )
5656 {
5757 $ mediaGalleryEntriesChanged = $ observer ->getEvent ()->getMediaGallery ();
58+ $ mediaGalleryLabelsChanged = $ observer ->getEvent ()->getMediaGalleryLabels ();
5859
59- if (empty ($ mediaGalleryEntriesChanged )) {
60+ if (empty ($ mediaGalleryEntriesChanged ) &&
61+ empty ($ mediaGalleryLabelsChanged )
62+ ) {
6063 return ;
6164 }
6265
@@ -66,7 +69,11 @@ public function execute(Observer $observer)
6669 $ productSkusToInvalidate [] = array_keys ($ productSkus );
6770 }
6871
69- $ productSkusToInvalidate = array_merge (...$ productSkusToInvalidate );
72+ foreach ($ mediaGalleryLabelsChanged as $ label ) {
73+ $ productSkusToInvalidate [] = [$ label ['imageData ' ]['sku ' ]];
74+ }
75+
76+ $ productSkusToInvalidate = array_unique (array_merge (...$ productSkusToInvalidate ));
7077 $ products = $ this ->productRepository ->getList (
7178 $ this ->criteriaBuilder ->addFilter ('sku ' , $ productSkusToInvalidate , 'in ' )->create ()
7279 )->getItems ();
Original file line number Diff line number Diff line change @@ -1694,7 +1694,12 @@ protected function _saveProducts()
16941694 $ this ->_saveProductAttributes ($ attributes );
16951695 $ this ->_eventManager ->dispatch (
16961696 '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+ ]
16981703 );
16991704 }
17001705 return $ this ;
You can’t perform that action at this time.
0 commit comments