Camillio Posted November 10, 2020 Share Posted November 10, 2020 I have an online store on PrestaShop 1.6. How can I make the category description not appear in full? I would like there to be a "Show more" button after 700 characters. Below is the code of my category.tpl {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {include file="$tpl_dir./errors.tpl"} {if isset($category)} {if $category->id AND $category->active} <h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span></h1> {if !empty($category->description)} <div id="category-description" class="rte">{$category->description}</div> {/if} {if $products} <div class="filters-panel"> <div class="row"> <div class="col-md-4 col-lg-4 hidden-sm hidden-xs view-mode"> <a class="view-grid active" href="#"><span class="fa fa-th"></span><label>{l s='Grid'} </label></a><a class="view-list" href="#"><span class="fa fa-list"></span><label>{l s='List'}</label></a> </div> <div class="col-sm-6 col-md-4 col-lg-4 compare-box"> {include file="./product-compare.tpl"} </div> <div class="col-sm-6 col-md-4 col-lg-4 product-sort"> {include file="./product-sort.tpl"} </div> </div> </div> {include file="./product-list.tpl" products=$products} <div class="filters-panel-bottom"> <div class="row"> {include file="./pagination.tpl"} </div> </div> {/if} {elseif $category->id} <div class="alert alert-warning"><button data-dismiss="alert" type="button" class="close">X</button>{l s='This category is currently unavailable.'}</div> {/if} {/if} how to set the length of the category description? Link to comment Share on other sites More sharing options...
JBW Posted November 11, 2020 Share Posted November 11, 2020 You can shorten the text by using smarty truncate modifier https://www.smarty.net/docsv2/en/language.modifier.truncate.tpl But this won't display a "Show more" option, you need some script for this. Maybe you want to try my module Expandable descriptions (https://addons.prestashop.com/en/product.php?id_product=49795) - it can shorten all kind of descriptions, category, product short & long description etc. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now