How to fix the «Unexpected token , in JSON» issue with the «showCaption» parameter of a media gallery in a third-party design theme?

gallery
javascript
third-party-extension
magento22
porto

(Dmitry Fedyuk) #1

01

02


How did I upgrade gymstar.ca from Magento 2.1.9 to 2.2.6?
(Dmitry Fedyuk) #2

Step 1

Locate the line:

"showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery/caption"); ?>,

and replace it with the following one:

"showCaption": <?php echo intval($block->getVar("gallery/caption")); ?>,

Step 2

Locate the line:

"showCaption": <?php /* @escapeNotVerified */  echo $block->getVar("gallery/fullscreen/caption"); ?>,

and replace it with the following one:

"showCaption": <?php echo intval($block->getVar("gallery/fullscreen/caption")); ?>,

Step 3

Locate the line:

"arrows": <?php /* @escapeNotVerified */  echo $block->getVar("gallery/fullscreen/arrows"); ?>,

and replace it with the following one:

"arrows": <?php echo intval($block->getVar("gallery/fullscreen/arrows")); ?>,