Knowledgebase

How to increase the allowed length of product names in PrestaShop

If it happens that some of your products have longer names (longer than about 35-45 symbols), just part of the product's name will be displayed on the category page of your store's frontend. Three dots will be added to the part of the name that is shown, suggesting that the name is longer. This only concerns the frontend; on the backend, of course, you can see the whole name.

You can increase the maximum number of the name's symbols that are displayed on the frontend by making a minor modification to the code of the particular theme's product-list.tpl file. If we use as an example the theme default-bootstrap (that's how its folder is labeled) and your store is installed in the root public_html directory of your PrestaShop hosting account, the path to the file would be public_html/themes/default-bootstrap/product-list.tpl. After you open the file find the following line of code:

{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}

By default, the number after truncate is 45. Of course, the original number in the code might be different depending on the theme. Change it to a number that suits your needs (e.g. 80).

You can modify the file from the Files section of the Pixie control panel. Another way to do it is to download it on your local computer with an FTP client (e.g. FileZilla), then edit it with a text editor (e.g. Notepad, Wordpad) and upload it back overwriting the old file.

In case you use a PrestaShop version older than 1.5, before you make changes to template files you should also enable the Force Compile option from the backend of your store (Preferences tab>Performance sub-tab). In this way after you make a change to a template file you'll be able to see the result when you refresh the frontend. When you're done with the modification disable the option. PrestaShop 1.5 and newer version are configured to recompile modified template files by default, so if you haven't changed the performance options then you don't have to worry about this.

Don't forget that modifications to the code of your theme's files will be overwritten when you update that theme. This will also happen to any changes to the code of the default theme when you update the whole PrestaShop application.

Was this answer helpful?

 Print this Article

Also Read