Jump to content

length of the category description/ short or full


Recommended Posts

For 1.6.0.14, is there a way to change short description to in category for longer text, for example 650?
I have multistore, and changed a category.tpl in my basic theme:

 

 

{if $category->description}

                            <div class="cat-desc rte">

                            {if Tools::strlen($category->description) > 650}

                                <div id="category_description_short">{$description_short}</div>

                                <div id="category_description_full" class="unvisible">{$category->description}</div>

                                <a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{l s='More'}</a>

                            {else}

                                <div>{$category->description}</div>

                            {/if}

                            </div>

                        {/if}

 

but without any result.

Thank you for any ideas...

 

Luk

 

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...

you need to replace:

{if Tools::strlen($category->description) > 350}
<div id="category_description_short">{$description_short}</div>

with:

{if Tools::strlen($category->description) > 800}
<div id="category_description_short">{$category->description|truncate:800:'...'}</div>

There are 2 different locations on the page with this code so you may need to try one or the other.

Edited by EWinchester (see edit history)
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...