1

In magento 2 I need to edit topmenu.phtml file. So I copied the topmenu.phtml file from:

vendor/magento/module_theme/view/frontend/templates/html/topmenu.phtml

into:

app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html  

and edited the file inside my theme module directory. But nothing changed. Someone please help me if am wrong.

Note: I have inherited Blank theme by copying all modules from vendor/magento/theme-frontend-blank into my theme directory.

  • Do you copied the file on app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/template/html/ folder?? – Asish Hira Apr 20 '16 at 6:28
  • yes. I have given path fully like you said – Ramya Apr 20 '16 at 6:35
  • check my answer – Asish Hira Apr 20 '16 at 6:36
5

Make sure that you paste the topmenu.phtml file under app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/ folder!

Also copy the layout files which you need app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/layout folder!

Then delete var folder!

Then Run php bin/magento cache:flush & php bin/magento setup:static-content:deploy from your root directory!

Hope this will help you to solve your problem.

|improve this answer|||||
  • Yeah I gave the path as you mentioned above. – Ramya Apr 20 '16 at 6:44
  • run the command – Asish Hira Apr 20 '16 at 6:45
  • 1
    Did you copy layout folder too?? If not then copy that file and paste it also on app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/.Try to enable template path hints and see that from where your template file is coming – Asish Hira Apr 20 '16 at 7:47
  • 1
    Yes.You are absolutely correct. When I copied the needed part into my xml file which is already present in that folder, It worked. Thank you so much. – Ramya Apr 20 '16 at 7:54
  • 1
    Welcome to community! Happy learning – Asish Hira Apr 20 '16 at 7:55
3

You have to set topmenu.phtml file inside below folder, You have to just create templates folder inside it.

app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/topmenu.phtml

Run commnad php bin/magento setup:static-content:deploy clear var folder and try again.

|improve this answer|||||
  • you can set topmenu.phtml file in above location which i have mentioned and check for changes. Its working. If not changes apply plz let me know. – Rakesh Jesadiya Apr 20 '16 at 6:49
  • No the changes are not applied – Ramya Apr 20 '16 at 6:53
  • 1
    have you created folder templates inside Magento_Theme, check spelling templates not only template. – Rakesh Jesadiya Apr 20 '16 at 6:54
  • If I create it as templates my contents are disappearing. – Ramya Apr 20 '16 at 6:57
  • run command php bin/magento setup:static-content:deploy – Rakesh Jesadiya Apr 20 '16 at 6:58

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.