Jump to content

(SOLVED) Product truncate in category - possible to set height to 2 lines?


Recommended Posts

When increasing the truncate of product-list.tpl titles display on 1 or 2 rows/lines. Short ones on 1 row and longer ones on 2 rows. It's doesn't look great on the screen because there are differences in height.

 

So you can increase truncate, but why not increasing titles default to 2 rows as well???

 

Edited by robbie007 (see edit history)
Link to comment
Share on other sites

 

 

So you can increase truncate, but why not increasing titles default to 2 rows as well???

truncating is not based on rows but on number of chars, some chars are wider that others, for example "W" is much wider than "i".

this is why it generating problems related to "width" of the title.

you have to use monospaced font...

Link to comment
Share on other sites

  • 2 weeks later...

Hi Vekia,

 

Here is a link to my website (sorry for the chinese), but I think it should be clear enough to show my issue: some of the products show the name a lot longer than the others. I set the truncate all to 20 and I expect them to show the same number of unicode characters before "...".

 

http://www.yaoay.com/zh/31-%E6%8A%A4%E8%82%A4%E4%BF%9D%E5%85%BB?p=2

Link to comment
Share on other sites

Henry,

 

Truncate by default tries to truncate by whole word. So if you have for example a var $productName with some long words, like:

 

(Truncate at 15: {$productName|truncate:15:"..."}    )

 

   "Green automobile",

 

it will show only

 

   "Green..."

 

as when including the word automobile, it would be too long (16 characters))

 

If you want to truncate by exactly the amount of characters, you can add a third parameter, like:

 

   {$productName|truncate:15:"...":true}

 

In above sample, this would result in 

 

   "Green automobil..."

 

For more info, see here

 

Hope this helps,

pascal.

Link to comment
Share on other sites

Henry,

About the search: Prestashop indexes words or product names (and description etc). When searching, it looks for words that start with the search string:

 

 

say Product name:  "Green Automobile"

 

PS indexes the words:

1) Green

2) Automobile

 

When searching for : "Aut" this product will be found

but when searching for "mobi"

This product won't be found, as no indexed word starts with mobi

 

To solve it, maybe you can add a space character before the English words, so that they will be indexed separately, instead of together with the Chinese characters before them.

 

if that won't work, there is some workaround here:https://www.prestashop.com/forums/topic/280306-native-prestashop-search-module-issuessolved-casesimprovementsother/?do=findComment&comment=1434584

 

But be careful, as the solution might slow down search considerably with databases with many products/long descriptions etc. (Read the whole thread to get an idea of the problems encountered then)

 

 

Hope this helps,

pascal

  • Like 1
Link to comment
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...