MAR 10 2017

Magento :: SyntaxError: expected expression, got ‘,’

Problem description

Image upload is broken in Magento after upgrade to 1.9.3 or SUPEE-8788 patch. The following error is logged in browser console:

SyntaxError: expected expression, got ','

In HTML source code you can see that one element is missing in media_gallery_contentJsObject variable:

var media_gallery_contentJsObject = new Product.Gallery('media_gallery_content', , {"thumbnail":{"label":"Thumbnail ","field":"product[thumbnail]"},"small_image":{"label":"Small Image ","field":"product[small_image]"},"image":{"label":"Base Image ","field":"product[image]"}});

Cause

The problem is caused by Creare/CreareSEO extension that override image uploader code.

Solution

Update app/design/adminhtml/default/default/template/creareseo/catalog/product/helper/gallery.phtml file with the following change:

--- app/design/adminhtml/default/default/template/creareseo/catalog/product/helper/gallery.phtml
+++ app/design/adminhtml/default/default/template/creareseo/catalog/product/helper/gallery.phtml
@@ -96,3 +96,3 @@
 //<![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() ?>);
+var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php echo $_block->getImageTypesJson() ?>);
 //]]>

or re-upload it from https://raw.githubusercontent.com/unxsist/CreareSEO/d5e0f35d21d290e61745d9c16a085b0b945f7fc0/app/design/adminhtml/default/default/template/creareseo/catalog/product/helper/gallery.phtml.

Posted in: Extensions, Troubleshooting

Magento :: SyntaxError: expected expression, got ‘,’
0 votes, 0.00 avg. rating (0% score)