- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
Magento. How to change number of characters displayed in product titles (if there is no reference to it in phtml)
February 10, 2016
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:
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:
-
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.
-
Open the file for editing and look for the following line of code:
productAttribute($_product, $_product->getName(), 'name') ?>
Replace it with the following code:
productAttribute($_product, $_product->getName() , 'name'), 0,10) ; ?>
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:
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