Jump to content

Modify Truncate using CSS


Guest

Recommended Posts

Hi

 

I need to change the truncate level on the subcategory list to show full category titles

 

I found this code in category.tpl

<h5><a class="subcategory-name" href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:80	:'...'|escape:'html':'UTF-8'|truncate:350}</a></h5>

The default: $subcategory.name|truncate:25 I have changed to 80 and that works great

 

But of course if o update prestashop version (currently 1.6.0.9) then it could be over ridden.

 

I have a css overide module. Can this truncate be altered via CSS?

Link to comment
Share on other sites

Not in a good way to be honest. You should name your theme so it is not the default theme and you will not have any issues with upgrades.

 

Yes, but the problem then is that the theme will not benefit from any future "good" upgrades pushed from Prestashop. But then again, I quite like how we have the theme now, so i suppose it may be best

Hello Haylau.

Yes, it's possible to do with css. Try this:

.truncate {  width: 250px;  white-space: nowrap;  overflow: hidden; text-overflow: ellipsis; }

Will that change every "truncate" on the whole site theme to be the same. I need it to be just this one occurrence. I will try it and see

Link to comment
Share on other sites

If you are just trying to target one category you can add {$category->name} to the body tag id and use #cars.trucate {css here} to target that one page. 

No, not a specific category

 

Basically it this :

Our category and subcategory names tend to be quite long because of the complexity of what we sell - and we have a lot of subcategories

 

When we click on a category all the subcategories are displayed, it is that list of sub categories I a need to truncate

 

So as you can see in the screen print, I have adjusted them using truncate in the tpl file. Just need the code to do the same in CSS, but I think I will go with the copying of the theme

 

post-246958-0-84907900-1420748110_thumb.jpg

Link to comment
Share on other sites

It will never work like I pointed out before. See this is the issue, with the css fix you need to add the truncate class to the category.tpl but an update will erase it. Or you can add the css to truncate to the category.css file. But at the same time an update will erase that as well. 

Link to comment
Share on other sites

×
×
  • Create New...