Using Magento v1.9.2.2 with patches SUPEE-7405 v1, SUPEE-7405 v1.1, SUPEE-8788, SUPEE-9652. Browsers: Safari & Chrome on Mac OSX.
I'm having an issue where none of the images in the product admin are displaying for some reason. It's not just images uploaded since any of the patches have been applied, it's all images, ever uploaded (see image for example).
All the images are still in the media folder, they still exist in the database and they still show up on the frontend.
I've tried various fixes but nothing seems to be coming up trumps, including:
- http://www.blog.magepsycho.com/how-to-fix-the-issue-product-images-missing-in-backend-but-not-in-frontend/
- Checked the Media folders exist and have the correct files
- Checked the permissions on the folders
- media_attribute is correct in the DB
- Renamed the .htaccess file in the media folder
- Flash installed and working
- JS/CSS file merge disabled
When inspecting the code in the admin panel I'm getting an "Unexpected Token ','" error in the media_gallery_contentJsObject script
//<![CDATA[var media_gallery_contentJsObject = new Product.Gallery('media_gallery_content', , {"cover_image":{"label":"Cover Image ","field":"product[cover_image]"},"image":{"label":"Base Image ","field":"product[image]"},"small_image":{"label":"Small Image ","field":"product[small_image]"},"thumbnail":{"label":"Thumbnail ","field":"product[thumbnail]"}});//]]>
Where just after 'media_gallery_content' there is a piece missing.
Comparing this to another store it would appear to be something along the lines of id_69c186495899f5764a731df5baafee05_UploaderJsObject that is missing.
Any ideas how to resolve this would be greatly appreciated.
-
Is JS/CSS files merge enabled in admin?Dmytro– Dmytro2017年02月23日 14:37:38 +00:00Commented Feb 23, 2017 at 14:37
-
It's disabled (another fix I've tried, forgot to add it to the list above).James Seddon– James Seddon2017年02月23日 14:54:05 +00:00Commented Feb 23, 2017 at 14:54
-
which browser do you using?Prasanta Hatui– Prasanta Hatui2017年02月23日 14:56:43 +00:00Commented Feb 23, 2017 at 14:56
-
Tried in Safari & Chrome on Mac. Sorry, added specs to top of post...James Seddon– James Seddon2017年02月23日 14:59:52 +00:00Commented Feb 23, 2017 at 14:59
2 Answers 2
Go to path
app/design/adminhtml/default/indent/template/catalog/product/helper/gallery.phtml
Comment Script
<script type="text/javascript">
//<![CDATA[
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null<?php else:?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif;?>, <?php echo $_block->getImageTypesJson() ?>);
//]]>
</script>
Add Script
<script type="text/javascript">
//<![CDATA[
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null,<?php else:?><?php if ($_block->getUploader()->getJsObjectName()):?><?php echo $_block->getUploader()->getJsObjectName() ?>,<?php endif;?><?php endif;?> <?php echo $_block->getImageTypesJson() ?>);
//]]>
</script>
I was having the same issue after migrating from Magento 1 to OpenMage.
In Magento 1, images are showing without any issues, but when switching to OpenMage with PHP8, the media gallery was not loading.
I have followed many blogs but couldn't get the result.
What I did
- Removed all third-party modules (moved all module xml files to a new subdirectory).
- Renamed the custom theme directory so that the default theme can be loaded.
- Have renamed
app/code/localdirectory to check if any custom code exists for core files. - Now that the gallery images are visible, change the original name to
app/code/local/and reduce the area by renaming each subdirectory where the issue exists one by one. - Finally, I found that there was a condition for
count()that I needed to update. - And, finally, after 2-3 days, it was working for me.
Explore related questions
See similar questions with these tags.