Jump to content

How to override Back Office views


dievacri

Recommended Posts

8 hours ago, dievacri said:

Hi,

I'm trying to modify the catalog products table of the back office and i 'm following the steps of the documentation (link) but it's only for PS 1.7.3 and i have PS 1.7.4. It is not working

 

Please help me.

Thanks

The process should be the same. Please explain what you did and what doesn't work.

Link to comment
Share on other sites

  • 2 weeks later...

It is working, there is a small change in folder structures.

Please check structure in src/PrestashopBundle folder first. There is an extra folder "CatalogPage" 

Now you have to put files in modules/foo/views/PrestaShop/Admin/Product/ CatalogPage/

It will start working.

 

 

Link to comment
Share on other sites

  • 9 months later...
  • 5 months later...

It is not working in Prestashop 1.7.3.2 either. My file-structure is:

/public_html/modules/aitm_productpricing/views/PrestaShop/Admin/Product/CatalogPage/lists/list.html.twig

Like other people is facing, no impact what os ever. I have strictly followed the documentation.
I can edit the BO just fine if I hardcode the files in src folder, but that's not ideal 😑

Edited by soduno (see edit history)
Link to comment
Share on other sites

Same problem here. Somebody knows how to override correctly twig admin templates for last Prestashop versions (1.7.6.x)?

If I understand right, you have to create a module and copy twig template files at views/Prestashop/Admin/Product/Forms/form_products.html.twig, for example, and then modify file to insert custom hooks, add new contents or wathever you want.

But my question is... simply coping templates files to correct path inside your module folder, and activating module is enought? You don't have to use any hook or other method to make know that you want to use modified templates instead of original ones?

Edited by Prestafan33 (see edit history)
Link to comment
Share on other sites

I made some more tests. It's working now.

You don't need to use any hook or anything else. You only need to re-create twig template path into your module folder, and then activate it, and clean cache. Obviously, your module has to be well formed.

But... this method sounds weird. How do you know if any template file is already modified by another module? You have to check all your modules looking for copies of the files?

If some modules are overriding the same file... how do you know what module has preference, and how to prevent another module override your changes? If you're simply extending templates is more easy, but if you're using your own modified copies of originals....

Edited by Prestafan33 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 7 months later...
  • 4 weeks later...

Hi! I'm on PS 1.7.6.1 and following the explanation on the documentation https://devdocs.prestashop.com/1.7/modules/concepts/templating/admin-views/ did work for me, using the following structure:

     modules/foo/views/PrestaShop/Admin/Product/CatalogPage/catalog.html.twig

And inside the twig files I used {% extends 'PrestaShopBundle:Admin/Product/CatalogPage:catalog.html.twig' %}

Hope it helps

Link to comment
Share on other sites

  • 6 months later...

Hi, I'm trying to repeat this tutorial 
Created folder in my Prestashop 1.7.7.2 
/modules/foo/views/Prestashop/Admin/Product/CatalogPage/

Then create file inside 

catalog.html.twig
this file includes
 

{% extends 'PrestaShopBundle:Admin/Product/CatalogPage:catalog.html.twig' %}

{% block product_catalog_filters %}
  Hello world!
{% endblock %}

Then went to products from back office catalog/products
But there's no changes  can't see Hello world! 
Do we need too include any php files in this foo module? How is it works folder foo includes only view twig file?

Link to comment
Share on other sites

1 hour ago, polaram said:

/modules/foo/views/Prestashop/Admin/Product/CatalogPage/

Problem is lowercase "Prestashop" need to be "PrestaShop".

After lot bangging head to it i got this.

 

thanks

Nice catch - changed folder to PrestaShop but stay still unchanged don't know why ...

Link to comment
Share on other sites

  • 1 month later...

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...