Categories

Featured templates

Magento. How to change number of characters displayed in product titles (if there is no reference to it in phtml)

Andre Flores February 10, 2016
Rating: 5.0/5. From 2 votes.
Please wait...

Hello! This video tutorial shows how to change the number of characters displayed in product titles in Magento (if there is no reference to it in phtml).

Magento. How to change number of characters displayed in product titles

Sometimes the number of characters for product titles is not set in .phtml files.

This is definitely what you may want to change since the long product names will not look nice:

magento_how_to_change_characters_numbers_for_priducr_titles_1

Let’s learn how to do that.

Let’s say you want to set the number of characters in product titles on the products listing page:

magento_how_to_change_characters_numbers_for_priducr_titles_2

  1. Using your FTP/Hosting control panel File Manager navigate to /app/design/frontend/default/themeXXX/template/catalog/product/ directory to locate the list.phtml file.

  2. Open the file for editing and look for the following line of code:

<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>

Replace it with the following code:

<?php echo substr($_helper->productAttribute($_product, $_product->getName() , 'name'), 0,10) ; ?>

magento_how_to_change_characters_numbers_for_priducr_titles_3

You may change the value of 10 to any other value to limit the product name to the desired number of characters.

Save the file to apply changes.

Navigate to your store front-end and refresh the page to see changes.

You can see the product names are now limited to 10 characters:

magento_how_to_change_characters_numbers_for_priducr_titles_4

This is the end of the tutorial. You have learnt how to change the number of characters displayed in product titles in your Magento store.

Feel free to check the detailed video tutorial below:

Magento. How to change number of characters displayed in product titles

Magento Templates
This entry was posted in Magento Tutorials and tagged character, Magento, number, phtml, product, title. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket