0

When i override the phtml using my custom theme in Magento 2, should i have to keep the view folder in the Module.

ie) view/frontend/templates and view/frontend/layout folder?

If i have to keep the layout xml inside the view/layout folder, should it be inside view/.. or what is the correct path?

UPDATED QUESTION:

After keeping my template in the template folder and xml in the layout folder of my theme.

Whats the content of the xml here : Vendor_Catalog::product/list/toolbar.phtml

Is it the my custom vendor_Catalog name or Magento_Catalog:: ...

<referenceBlock class="Vendor\Module\Block\Product\ProductList\Toolbar" name="product_list_toolbar" >
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Catalog::product/list/toolbar.phtml</argument>
      </action>
    </referenceBlock>
  • at which place want to keep file inside theme or your custom module? – Rakesh Jesadiya Sep 1 '16 at 6:48
  • inside my custom theme..sorry i dint mention that... – Sushivam Sep 1 '16 at 6:52
  • please check my answer – Rakesh Jesadiya Sep 1 '16 at 6:53
  • you have to give Magento_Catalog instead of your custom module name, if you have overrride file inside your custom module/extension then you have to give your custom module path – Rakesh Jesadiya Sep 1 '16 at 7:15
  • I got confused...Can u give eg for what yu mean by "if you have overrride file inside your custom module/extension then you have to give your custom module path" – Sushivam Sep 1 '16 at 7:17
1

When i override the phtml using my custom theme in Magento 2, should i have to keep the view folder in the Module.

If you have keep phtml file inside your custom theme, You doesn't need to keep view folder inside module.

If you want to override your core template file or core layout file into your custom theme, Path for that is below,

For override into your custom theme, you not need to declare view folder

Lets take example from Catalog module of core

For layout override,

magento2/app/design/frontend/Vendorname/themename/Magento_Catalog/layout

For Templates override,

magento2/app/design/frontend/Vendorname/themename/Magento_Catalog/templates

Thanks.

  • Please see my updated question!! – Sushivam Sep 1 '16 at 7:12

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.