Jump to content

Increasing the category description length before needing to click "More"


Recommended Posts

PrestaShop 1.5.3

 

I am trying to increase the amount of characters that show in the category description before needing to click "More". The default is 120 characters, which is one line. I'd like to up it to something like 8 lines. I have changed the two category description settings in the category.tpl to 1000, but it made no difference. Is there something I'm missing?

 

  {if $category->description}
<div class="cat_desc">
{if strlen($category->description) > 1000}
 <p id="category_description_short">{$category->description|truncate:1000}</p>
 <p id="category_description_full" style="display:none">{$category->description}</p>
 <a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more">{l s='More'}</a>
{else}
 <p>{$category->description}</p>
{/if}
</div>
  {/if}

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

  • 1 year later...
  • 3 weeks later...

Hi guys.

 

I tried to do the same on my website Medieplaneten.dk - but with no luck.

 

I tried to apply the following code:

 

{if $display_category_desc && $category->description}
<div class="cat_desc">
{if (!isset($sttheme.display_cate_desc_full) || !$sttheme.display_cate_desc_full) && strlen($category->description) > 1000}
                    {if isset($description_short)}
                    <div id="category_description_short">{$description_short|truncate:1000}</div>
                    {else}
<div id="category_description_short" style="height:1.5em;overflow:hidden;">{$category->description|truncate:1000}</div>
                    {/if}
<div id="category_description_full" style="display:none">{$category->description}</div>
<a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more go">{l s='More'}</a>
{else}
<div>{$category->description}</div>
{/if}
</div>
{/if}
</div>
 
Any ideas what i did wrong?
 
Best regards
 
Christian
Edited by chsode (see edit history)
Link to comment
Share on other sites

i cant find any product on your website with this button

True. I changed the design as i could not get it to work.

 

I wanted it to either show as i wanted it to, or just move it down under the products, and as i could not get it to work i decided to move it instead :)

Link to comment
Share on other sites

  • 3 years later...

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...