0

good morning everyone, I am a little bit new on Magento 2.x, I am working the full time make some changes in some view which contains a template but I suffer and struggle to know which template in question I am working within the current path, can anyone please give me some hints how to know which template I am working within the current path

--> can anyone save my time by telling me how, please?

1
  • Go to admin panel > Choose Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront > Click Yes to Enabled Template Path Hints. Commented Mar 27, 2020 at 6:03

4 Answers 4

1

Update

Check your store mode

deploy:mode:show

First enable Developer mode

bin/magento deploy:mode:set developer

Enable Template Path Hints in Admin Configuration

Step 1: Go to admin panel

Step 2: Choose Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront

Step 3: Click Yes to Enabled Template Path Hints

And you can also enble and disable using command

php bin/magento dev:template-hints:enable

php bin/magento dev:template-hints:disable

Enabled Template Path Hints for Admin

Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Admin > Yes

Note:if not working then run magento setup upgrade and flush magento cache command I Hope This Helps You.

21
  • i follow this steps bro , but it's still telling me in debug option that this is not provided in production mode, but and my mode is developer !!?? Commented Mar 26, 2020 at 15:15
  • So please check you mode and if developer then again follow above steps and run setup upgrade and clean and flush magento cache. Then it's works
    – Msquare
    Commented Mar 26, 2020 at 15:19
  • i am in developer mode bro , but i can't access to this 'Debug > Enabled Template Path Hints for Storefront', the field is disable and gives me this message bellow => "Not available in production mode." Commented Mar 26, 2020 at 15:23
  • So bro it's means your store in production mode please set into developer mode .
    – Msquare
    Commented Mar 26, 2020 at 15:25
  • Used this comman deploy:mode:show to show your current mode.
    – Msquare
    Commented Mar 26, 2020 at 15:28
0

You can enable template path hint to show which template is rendering on specific page. for this follow below step.

Make sure you are in developer mode to show this option.

Step 1: Go to admin panel
Step 2: Choose Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront
Step 3: Click Yes to Enabled Template Path Hints

Enable Template Path Hints via Command Line:

php bin/magento dev:template-hints:enable

For disable it

bin/magento dev:template-hints:disable

then

bin/magento cache:clean
1
  • i follow all this step , but it's still telling me in debug option that this is not provided in production mode, but and my mode is developer !!?? Commented Mar 26, 2020 at 15:12
0

Whilst enabling template hints is a good option I prefer to just search for something that appears remotely unique, for example if I'm looking for the template that renders the copyright text I just search all PHTML files (*.phtml) for class="copyright" and within a second my editor tells me the file is vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml.

I find that method much quicker and easier than enabling template hints, the downside is if there is not something unique to search for it may return several templates.

2
  • good bro n but when the page is xml file not phtml , some time it's hard to fin which class used for example in a field Commented Mar 26, 2020 at 16:53
  • For XML files it's a case of search *.xml files, for example if you want to find where class="page-header" comes from you can search for htmlClass="page-header". If you're unsure what file type it is you can search both for page-header. If you're new to Magento then the template hints method will likely be better for you.
    – Ben Crook
    Commented Mar 26, 2020 at 17:45
0

It's simple:

1: Sign in to Magento admin panel

2: Then navigate to the: Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront

3: Click Yes to Enabled Template Path Hints

Ensure that you've enabled the developer mode. Here's the command to enable the developer mode: bin/magento deploy:mode:set developer

I hope that will work for you if you need more help, follow this official guide by Magento: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/debug-theme.html

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.