Jump to content

How to edit TWIG files? Changes aren't visible!


Housy

Recommended Posts

Hello

 

Within Back Office of Prestashop version 1.7 I would like to prevent viewing the "Cost price" for employees without "SuperAdmin" status. In some other thread i have seen how this can be done but the solution was for previous 1.6 versions and below. I have succesfully found the right file and the reason why i have opened this thread is that i have no idea how to work with TWIG file exstension.

 

I would like to modify this file - "src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig"

 

I can open TWIG file with Notepad++ but if i make any changes by adding just some random heading tag and then refresh product editing page in the Back Office and click on the "Pricing" tab, i don't see an extra heading tag. Page remains the same as it is by default. Everything works but changes aren't visible.

 

What am i doing wrong? What would be the right approach to edit TWIG files?

 

Thank you and best regards,

Housy

  • Like 1
Link to comment
Share on other sites

I had to clear Cache and now i can see changes.

 

But still I have some questions. Is it wrong to directly modify TWIG files? Can i do any harm to my store or is it fine?

 

Regards,

Housy

  • Like 1
Link to comment
Share on other sites

  • 5 years later...
On 6/7/2017 at 3:17 AM, Housy said:

Is it wrong to directly modify TWIG files? Can i do any harm to my store or is it fine?

I do not recommend to do change core admin twig directly, you will loose your changes with PS upgrades. Rather do this inside a module extending the original twig:

https://devdocs.prestashop-project.org/8/modules/concepts/templating/admin-views/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...