2

I have a module which has a visual output and therefore I like to extend an existing layout.

From what I read the magento2 way is to add a ne layout in app/design/frontend (according to http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-extend.html)

So my structure looks like this:

app/code/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml

catalog_product_view.xml

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <container name="product.info.media" htmlTag="div" htmlClass="product media" after="product.info.main">
                <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="product/view/gallery.phtml"/>
            </container>
        </referenceContainer>
    </body>
</page>

The content block is not changing in any way, so there seems either to be something missing or I have a missunderstanding here. Any help is appreciated.

EDIT

My magento2 code is from https://www.magentocommerce.com/download so everything is placed in vendor/. Maybe that's why it is not working ?!

Thanks

1 Answer 1

4

You need to move this xml file to the following path : app/design/frontend/<vendorName>/<themeName>/Magento_Catalog/layout/catalog_product_view.xml and also, this theme must be activated in Backend.

7
  • I edited, please view again
    – LinoPham
    Commented Dec 1, 2015 at 10:40
  • so e.g app/design/frontend/Unreal/Mytheme/Magento_Catalog/layout/catalog_product_view.xml ? or better app/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml
    – xhallix
    Commented Dec 1, 2015 at 10:40
  • Yes, I edited my answer
    – LinoPham
    Commented Dec 1, 2015 at 10:41
  • I changed it to app/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml but it does not have any effect In my themes I can see Magento/luma , so I seems to miss something still
    – xhallix
    Commented Dec 1, 2015 at 10:43
  • You should add tag <referenceContainer name="product.info.main" remove="true"/> to check override
    – LinoPham
    Commented Dec 1, 2015 at 10:46

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.