Jump to content
Lukasz.wroclaw

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

 

 

Share this post


Link to post
Share on other sites

It count the html tags. Maybe you have a longer description than 650 because of html tags.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More