I want to have the photo gallery in a tab like some of the other content. I then tried as per below.
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_product_view.xml I have the following :
<body> <referenceBlock name="product.info.details"> <block class="Magento\Catalog\Block\Product\View" name="gallery.tab" as="gallery" template="product/view/photogallery.phtml" group="detailed_info" > <arguments> <argument translate="true" name="title" xsi:type="string">Gallery</argument> </arguments> </block> <move element="product.info.media" destination="gallery.tab" after="-" /> </referenceBlock> </body>
then I have in
app/design/frontend/Vendor/Theme/Magento_Catalog/templates/product/view/photogallery.phtml just one line.
<?php echo $block->getChildHtml();?>
gallery.js:453 Uncaught TypeError: Cannot read property 'setOptions' of undefined
For configurable product there is an error too though not the same :
gallery.js:487 Uncaught TypeError: Cannot read property 'data' of undefined
Additionally, the refresh of the gallery for configurable+swatch products is then not working neither
I tried as well to change in the layout file
app/design/frontend/Vendor/Theme/Magento_Catalog/layout/catalog_product_view.xml so that it put the Gallery block in the details group directly, it simply does not show any gallery anymore.
<move element="product.info.media" destination="product.info.details" after="-" /> <referenceBlock name="product.info.media" group="detailed_info"> <arguments> <argument translate="true" name="title" xsi:type="string">Gallery</argument> </arguments> </referenceBlock>
How can I safely move the Gallery to a tab?
Edit 2016-10-06 : It appears that the issue comes at the initialization of the fotorama. Where is that triggered?
Further test showed that if the Gallery is nested in a div that has
display:none; then it throws me the errors.