cancel
Showing results for 
Search instead for 
Did you mean: 

How can I apply changes which i made in template file?

How can I apply changes which i made in template file?

Hello
How can I apply changes which i made in template file? (example file path - \app\design\frontend\{Theme vendor Name}\{theme name}\{Custom Module name}\templates\html\categories-on-main.phtml ). I just made few changes (delete two attributes - http://prntscr.com/oicpcl ) and want to see how it works on the website. Вut this changes did not apply - attributes still appeared ( http://prntscr.com/oicqdl ) ...

Magento ver. 2.0.8

P.S. My website is on production mode, if this matters 
Cache cleared and disabled at all

5 REPLIES 5

Re: How can I apply changes which i made in template file?

@alex_moren 

 

Your question is partially unclear. can you please explain more what do you want exactly?

 

  1. Do you want to override your custom module phtml file and modify it?
  2. Or do you want to override core Magento phtml file and modify it?
If Issue Solved, Click Kudos/Accept As solutions.

Re: How can I apply changes which i made in template file?

I want to modify my custom module phtml file. I made few changes in this file \app\design\frontend\{Theme vendor Name}\{theme name}\{Custom Module name}\templates\html\categories-on-main.phtml . Then I:
 - ran command php bin/magento setup:static-content:deploy
 - ran command php bin/magento cache:flush
 - cleared all cache in adminpanel
my modifies appeared in phtml file in var/view_prepocessed folder. But this changes didn't appear on the website.. 
What should I do to modify files and apply this changes on website?

Re: How can I apply changes which i made in template file?

Step-2-step:
 - disable all cache from adminpanel http://prntscr.com/oivr2o 
 - modify some phtml file in my custom module (for example \app\design\frontend\{Theme vendor Name}\{theme name}\{Custom Module name}\templates\product\gallery.phtml
 - run command php bin/magento setup:static-content:deploy
 - run command php bin/magento cache:flush
 - clear and disable browser cache
 - reload page
My modifications weren't applied
 - check corresponding file in view_preprocessed folder ( path - \var\www\var\view_preprocessed\html\app\design\frontend\{Theme vendor Name}\{theme name}\{Custom Module name}\templates\product\gallery.phtml - my modification appeared in the file
 -  reload page
My modifications weren't applied
 - enable Template Path Hints to check that files match with each other
 - file path completely same http://prntscr.com/oiufhj 
 -  reload page
My modifications weren't applied
 So my modification appeared in the file but didn't appear on website and i can't understand want is the point

Re: How can I apply changes which i made in template file?

If you want to modify your custom module phtml file you should try with layout XML way.

 

 

<referenceBlock name="block-name">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">MyCustom_Module::path/to/my/file.phtml </argument>
    </action>
</referenceBlock>

For more reference How to override phtml file of a custom module in magento 2

 

I hope it helps!

 

If Issue Solved, Click Kudos/Accept As solutions.

Re: How can I apply changes which i made in template file?

I have already modified phtml files and my modification appeared in corresponded file in view_preprocessed folder after deploying. The problem is that this modifications didn't appear on website when I open it in browser, even after clearing all cache in browser and Magento and disabling caсhe at all. Maybe I missed some caching level anywhere else or maybe old phtml file can be downloaded not only from view_preprocessed folder I don't know..  

So, the main question is :
 - Why is old html still appear on website without my modifications? (despite the cache was cleared and disabled)? Where else could old files be downloaded from?

P.S. Sorry for my bad English.. Hope I I described my problem clearly enough. All my actions was listed in a previous post