Page 1 of 1
product has a long name how shorten it in Homepage
Posted: Tue Aug 05, 2014 9:30 pm
by omar_ali222
hello , I hope you are well guys .
1- When the product has a long name ,I want to shorten it when it appears in the Homepage.
2- How do I control the number of lines .
Re: product has a long name how shorten it in Homepage
Posted: Tue Aug 05, 2014 9:52 pm
by Tcalp
You'd want to use sub string to shorten off the text:
http://php.net/manual/en/function.substr.php
Re: product has a long name how shorten it in Homepage
Posted: Tue Aug 05, 2014 9:59 pm
by omar_ali222
Tcalp thanks
Could you give me steps more clearly Where can I put these ,please
Re: product has a long name how shorten it in Homepage
Posted: Thu Aug 07, 2014 9:50 pm
by omar_ali222
hello guys
Could anyone explain me more clear please
Re: product has a long name how shorten it in Homepage
Posted: Fri Aug 08, 2014 2:53 am
by Dhaupin
It looks like your titles are already using substr(). To shorten them just adjust the last number in the operation. This is most likely found in the conroller for your list, module, feed, or other area. These are found in yourstore/catalog/controller/ in whatever folder is applicable. So find the controller file you need and look for the title var or whatever is making product titles.
For example, it may look something like this in one of those controllers:
What does it mean?
- Cut the output of $result['name'] off when i say
- Start from 0 which is the first char
- Count 100 chars of $result['name'] then stop
- Only output 100 chars of $result['name']
By changing the 100, it changes the chars it outputs from the string/title. So if you enter 50, it will make your titles half as long. Keep in mind, each area of display probably has its own controller, so adjust it everywhere

Re: product has a long name how shorten it in Homepage
Posted: Sat Aug 09, 2014 4:18 am
by omar_ali222
Dhaupin wrote:It looks like your titles are already using substr(). To shorten them just adjust the last number in the operation. This is most likely found in the conroller for your list, module, feed, or other area. These are found in yourstore/catalog/controller/ in whatever folder is applicable. So find the controller file you need and look for the title var or whatever is making product titles.
For example, it may look something like this in one of those controllers:
What does it mean?
- Cut the output of $result['name'] off when i say
- Start from 0 which is the first char
- Count 100 chars of $result['name'] then stop
- Only output 100 chars of $result['name']
By changing the 100, it changes the chars it outputs from the string/title. So if you enter 50, it will make your titles half as long. Keep in mind, each area of display probably has its own controller, so adjust it everywhere

thank you so much thanks