Jump to content

limit length description in the list of categories in back office


Recommended Posts

In Prestashop 1.7, in the Back Office, when you go to Catalog - Categories and the list of categories is shown, if you have many and the description of each one is very wide, it is very difficult to work because it occupies a lot of screen and is not agile . He tried by all means to limit the characters defined in the description but there is no way. He tried for 4 hours and tried solutions and nothing. It seems that the back office templates are with Twig and inside the / src / folder, but he also didn't find a way .. Anyone around here would know how to do it? Attached image that looks clear what the problem is.

regards

 

thanks

categorias-grandes.png

Share this post


Link to post
Share on other sites

Hi, you can go to: src\Core\Grid\Data\Factory\CategoryDataFactory.php

Change line

$records[$key]['description'] = strip_tags(stripslashes($record['description']));

To

$records[$key]['description'] = substr(strip_tags(stripslashes($record['description'])), 0, 20);

20 is characters display

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot !

This is useful for version 1.7.6.2 but it is not useful for another website that I have in 1.7.5.2 because in the Factory folder I only get 2 files: DoctrineGridDataFactory.php and GridDataFactoryInterface.php... How do I fix in 1.7.5.2 version?

 

thanks !

Share this post


Link to post
Share on other sites

In 1.7.5.0, file: controllers\admin\AdminCategoriesController.php

Change

return Tools::getDescriptionClean($description);

To

return substr(Tools::getDescriptionClean($description), 0, 20);

 

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More