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