Porto Theme problem: Uncaught SyntaxError, image not loading

Hello!
I’m new and I need your help:

I use Magento 2.3.4 and I have a problem with Porto Theme at product page. Images not loading and in console I have the following errors:

*Uncaught SyntaxError: Unexpected token , in JSON at position 2821*
*    at JSON.parse (<anonymous>)*
*    at getNodeData (scripts.js:87)*
*    at Array.map (<anonymous>)*
*    at scripts.js:117*
*    at HTMLDocument.apply (main.js:70)*
*    at fire (jquery.js:3238)*
*    at Object.add [as done] (jquery.js:3297)*
*    at jQuery.fn.init.jQuery.fn.ready (jquery.js:3548)*
*    at jQuery.fn.init (jquery.js:2973)*
*    at new jQuery.fn.init (jquery-migrate.js:241)*

Or you can see here: http://doporro.ro/cadita-de-dus-xetro04w.html (is a test website)

For Porto I installed the following patch:

Patch for Magento 2.3.1 And Above
Patch for Magento 2.3.3 And Above
Patch for Magento 2.3.x

I don’t know how to solve this problem, please help me. Thank You!

I had the same problem on Sunday so it’s not isolated.
Is there a special order to these patches?
If you’re on 2.3.4 do you just patch with the 2.3’s?
Just making sure I’m not doing something daft!

Hi @C0olmonkey and welcome.

According to the Porto Theme Comments Page, others have also reported the same “Uncaught SyntaxError” issue.

If I recall correctly, there was a patch that addressed the image loading issue due to a compatibility issue with Magento 2.3.x. I believe you’ll find this post of use: Porto Theme - Product Images not loading

Hi @Chris_Bentley and welcome.

The order I do it (assuming I’m running Magento 2.3.4):

  1. Install Porto
  2. Upload contents from Patch for Magento 2.3.1 And Above
  3. Upload contents from Patch for Magento 2.3.3 And Above
  4. Upload contents from Patch for Magento 2.3.x

The order which you upload the patched files doesn’t matter as they all contain different files.

Patch Contents

I’m not sure what they all specifically fix.

Patch for Magento 2.3.1 And Above

app\design\frontend\Smartwave\porto\Magento_Catalog\templates\product\view\details.phtml

Patch for Magento 2.3.x

app\design\frontend\Smartwave\porto\Magento_Checkout\web\css\source\module\checkout\_tooltip.less
app\design\frontend\Smartwave\porto_rtl\Magento_Checkout\web\css\source\module\checkout\_tooltip.less

Patch for Magento 2.3.3 And Above

app\code\Smartwave\Filterproducts\Block\Home\BestsellersList.php
app\code\Smartwave\Filterproducts\Block\Home\FeaturedList.php
app\code\Smartwave\Filterproducts\Block\Home\LatestList.php
app\code\Smartwave\Filterproducts\Block\Home\SaleList.php
app\code\Smartwave\Filterproducts\FeaturedList.php
app\code\Smartwave\Porto\Helper\Data.php
app\design\frontend\Smartwave\porto\Magento_Catalog\templates\product\list\items.phtml
app\design\frontend\Smartwave\porto\Magento_Catalog\templates\product\list.phtml
app\design\frontend\Smartwave\porto\Magento_Catalog\templates\product\list\items.phtml
app\design\frontend\Smartwave\porto\Smartwave_Filterproducts\templates\grid.phtml
app\design\frontend\Smartwave\porto\Smartwave_Filterproducts\templates\owl_list.phtml
app\design\frontend\Smartwave\porto\Smartwave_Filterproducts\templates\side_list.phtml
app\design\frontend\Smartwave\porto\Smartwave_Filterproducts\templates\small_list.phtml

It’s still not working correctly.

And I’m still at a loss as to what I’m supposed to be patching as I’ve done the 2.3’s without success.
Am I supposed to be patching at all as Magento 2.3.4 as the other page says not?

The Porto documentation instructions are awful!

Just the ones I mentioned above. The only other issues I’ve found similar to your own appear to have been resolved after uploading the aforementioned patches.

It’s logical to conclude that the patch that fixes this issue is the new details.phtml file above. If you’re already overriding this file in a child theme then you’ll also need to upload a copy of this file to that location too. This could explain why uploading the patched file is having no affect - Because Magento isn’t reading that particular file. Example:

app\design\frontend\Smartwave\<CHILD THEME FOLDER>\Magento_Catalog\templates\product\view\details.phtml

I’m not getting any further on this. I’m on Mage 2.3.4
I’ve downloaded a fresh version of Porto and uploaded Porto Theme.
I’ve then patched with…
2.3.x
2.3.1
2.3.3
But am still getting the wheel of dots.
I’ve entered the following…
php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:static-content:deploy -f

Without any change.
I’ve installed Patch for product detail 2.0.x
Still no change.

The error is…
Uncaught SyntaxError: Unexpected token , in JSON at position 1766
at JSON.parse ()
at getNodeData (scripts.js:87)
at Array.map ()
at scripts.js:117
at HTMLDocument.apply (main.js:70)
at fire (jquery.js:3238)
at Object.add [as done] (jquery.js:3297)
at jQuery.fn.init.jQuery.fn.ready (jquery.js:3548)
at jQuery.fn.init (jquery.js:2973)
at new jQuery.fn.init (jquery-migrate.js:241)

I’m sure I’m not this bad at installing extensions so something is going wrong.
On that point, I’ve never had such a problem uploading files as I have with this extension with multiple failed transfers. Don’t know if its due to the folder name length but on the new download I put it in a very short name directory and it only failed on one file.

20 hours ago support posted this…

  1. Please upload all required theme patches mentioned in theme package to your site directory (from Patch for Magento 2.2.x > patch for Magento 2.3.1 & above)

  2. You can see the changes of each theme version in Porto preview page https://themeforest.net/item/porto-ultimate-responsive-magento-theme/9725864

That sorted it!

I solved the problem after I installed the following patch:

  • Patch for Magento 2.2.x And Above
  • Patch for Magento 2.2.4 And Above

In conclusion for Magento 2.3.4 you need to install
Patch for product detail 2.0.x
Patch for Magento 2.2.x And Above
Patch for Magento 2.2.4 And Above
Patch for Magento 2.3.1 And Above
Patch for Magento 2.3.3 And Above
Patch for Magento 2.3.x

Thank you for your help!

I believe also…
Patch for product detail 2.0.x

Yes, also Patch for product detail 2.0.x, I updated my post

2 Likes