File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
app/code/Magento/Catalog/Block/Product/View Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -235,17 +235,18 @@ private function getGalleryImagesConfig()
235
235
}
236
236
237
237
/**
238
- * @param string $image
239
238
* @return string
240
239
*/
241
- public function getMainProductImage ()
240
+ public function getMainProductImage ($ size = ' medium_image_url ' )
242
241
{
243
- $ image = $ this ->getGalleryImages ()->toArray ()['items ' ][0 ]['medium_image_url ' ];
242
+ foreach ($ this ->getGalleryImages () as $ image ) {
243
+ $ image = $ image ->getData ($ size );
244
244
245
- if (!$ image ) {
246
- return $ this ->_imageHelper ->getDefaultPlaceholderUrl ('image ' );
247
- }
245
+ if (!$ image ) {
246
+ return $ this ->_imageHelper ->getDefaultPlaceholderUrl ('image ' );
247
+ }
248
248
249
- return $ image ;
249
+ return $ image ;
250
+ }
250
251
}
251
252
}
You can’t perform that action at this time.
0 commit comments