File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
app/code/Magento/Catalog/Controller/Adminhtml/Product Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,7 @@ public function execute()
194
194
*/
195
195
private function handleImageRemoveError ($ postData , $ productId )
196
196
{
197
+
197
198
if (isset ($ postData ['product ' ]['media_gallery ' ]['images ' ])) {
198
199
$ removedImagesAmount = 0 ;
199
200
foreach ($ postData ['product ' ]['media_gallery ' ]['images ' ] as $ image ) {
@@ -204,10 +205,12 @@ private function handleImageRemoveError($postData, $productId)
204
205
if ($ removedImagesAmount ) {
205
206
$ expectedImagesAmount = count ($ postData ['product ' ]['media_gallery ' ]['images ' ]) - $ removedImagesAmount ;
206
207
$ product = $ this ->productRepository ->getById ($ productId );
207
- if ($ expectedImagesAmount != count ($ product ->getMediaGallery ('images ' ))) {
208
- $ this ->messageManager ->addNoticeMessage (
209
- __ ('The image cannot be removed as it has been assigned to the other image role ' )
210
- );
208
+ if (is_array ($ product ->getMediaGallery ('images ' ))) {
209
+ if ($ expectedImagesAmount != count ($ product ->getMediaGallery ('images ' ))) {
210
+ $ this ->messageManager ->addNoticeMessage (
211
+ __ ('The image cannot be removed as it has been assigned to the other image role ' )
212
+ );
213
+ }
211
214
}
212
215
}
213
216
}
You can’t perform that action at this time.
0 commit comments