0

I have this catalog_product_view.xml in my theme layout folder.

I want to edit the html code for this part all-products-left-wrapper,

<referenceContainer name="content">
    <container name="all-products-left-wrapper" label="All Products Left Wrapper" as="all-products-left-wrapper" htmlTag="div" htmlClass="all-products-left-wrapper" before="-">    
    </container>
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.media.image" template="product/view/mediaimage.phtml" />  
</referenceContainer>

But I have searched all over my Magento folders, I simply can't find the phtml file for this?

But on the front-end, when I look at the source code from browser, I do see this is generated <div class="all-products-left-wrapper">. So how does Magento 2 render it's .xml files to html?

0

This is a duplicate of a few SE answers (this for example), but the short answer is that default theme files are under vendor/magento and you can copy them to your theme just like in Magento 1, but there is a significant difference in naming conventions for the pathname in Magento 2.

In your example, the default file should be located at vendor/magento/module-catalog/view/frontend/templates/product/view/mediaimage.phtml

If you have an activated and applied theme (we will use Your_Theme for this example). The file can be copied to

app/design/frontend/Your/Theme/Magento_Catalog/templates/product/view/mediaimage.phtml

and then you can edit away!

2
  • The other awswer are about how to override .phtml file. this is not the issue for me, as I already known how to override the .phtml file. my issue in my question was actually, I can't even find the .phtml file for the <container name="all-products-left-wrapper"> from the .xml file. if i can find the .phtml file for this container, then I can override it. Apr 10 '18 at 19:19
  • 1
    @xxx It is a strangely-named file that I haven't ran across while working on media templates. Have you found anything by turning on template hints?
    – mtr.web
    Apr 10 '18 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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