2

Not even sure where to begin with this one. Updated Magento from 2.2 to 2.3, and now when you go to a product page, only the image loads. There's nothing in the body but that and some javascript, then an error:

Uncaught Error: Call to a member function getOptionsJson() on null in /home/vagrant/code/vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml:46

Which is pointing at "options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>, but I have absolutely no idea what getGalleryOptions is doing or why it would be null.

3 Answers 3

4

This was raised as an issue on the Magento github and is caused by an incompatibility with custom code in your theme. you will find more info and a solution here

You need to locate in whichever of your third party modules is instantiating an instance of the "\Magento\Catalog\Block\Product\View\Gallery" class in its layout xml files and ensure it is injecting the argument "gallery_options" to the block

0
                <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="product/view/gallery.phtml">
<arguments>
    <argument name="gallery_options" xsi:type="object">Magento\Catalog\Block\Product\View\GalleryOptions</argument>
</arguments>
0
       <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="product/view/gallery.phtml">
         <arguments>
               <argument name="gallery_options" xsi:type="object">Magento\Catalog\Block\Product\View\GalleryOptions</argument>
           </arguments>
     </block>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.