S7 Media Ltd Posted May 9, 2013 Share Posted May 9, 2013 Hi there, hopefully someone can help! I've trawled through the admin folders and controllers but nothing is catching my attention. We have large descriptions for some of our categories, and therefore makes the admin section look ugly (when viewing the list of categories). Is there any way we can truncate the category descriptions just viewing the category list (don't want to truncate the actual description, just the view). Thanks in advance Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 Hi there, hopefully someone can help! I've trawled through the admin folders and controllers but nothing is catching my attention. We have large descriptions for some of our categories, and therefore makes the admin section look ugly (when viewing the list of categories). Is there any way we can truncate the category descriptions just viewing the category list (don't want to truncate the actual description, just the view). Thanks in advance for the first, we must know what prestashop version you use regards Link to comment Share on other sites More sharing options...
S7 Media Ltd Posted May 9, 2013 Author Share Posted May 9, 2013 You are quite right, my apologies. I'm using 1.5.3.1. Thankyou. Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 thanks so you need to edit template file for helpers. It's easy. Go to the YOUR_ADMIN_DIR/themes/default/template/helpers/list/list_content near the ~103 line you've got: {elseif isset($params.callback)} {$tr.$key} change it to: {elseif isset($params.callback)} {if $key=="description"} {$tr.$key|substr:0:25} ... {else} {$tr.$key} {/if} the most important thing is: {$tr.$key|substr:0:25} substr mean that we cutting this variable, only 25 first chars will appear. You can personalize this as you want. remember that this is a smarty template, so you probably have to turn force compilation on in preferences -> performance to recompile the theme. let me know if this works for you :-) or not 2 Link to comment Share on other sites More sharing options...
S7 Media Ltd Posted May 9, 2013 Author Share Posted May 9, 2013 Vekia, that's absolutely brilliant, thank you very much for your help and quick response. Works perfect Never would have thought to look in that file! Thanks again. Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 Vekia, that's absolutely brilliant, thank you very much for your help and quick response. Works perfect Never would have thought to look in that file! Thanks again. You're welcome :-) Now i can go ahead and mark this thread as solved for other forum members regards Link to comment Share on other sites More sharing options...
kingsinnersoul Posted May 30, 2013 Share Posted May 30, 2013 Hello there, Is that the same solution for PS 1.5.4.1? What if I am using a custom theme? Thanks Link to comment Share on other sites More sharing options...
vekia Posted May 30, 2013 Share Posted May 30, 2013 but you probably mean, that you use custom theme only for front office, not back office. Am i Right? If so, it will work for you Link to comment Share on other sites More sharing options...
kingsinnersoul Posted May 30, 2013 Share Posted May 30, 2013 (edited) I asked because I tried your solution and it did not work. Instead I used it in the category.tpl file. Instead of (around line 95) <p class="cat_desc"> {$subcategory.description} </p> I did: <div class="cat_desc"> {if strlen($subcategory.description) > 200} <p id="category_description_short"> {$subcategory.description|truncate:200} </p> <p id="category_description_full" style="display:none"> {$subcategory.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 class="cat_desc"> {$subcategory.description} </p> {/if} </div> I am sure that the above code, is not 100% correct, but it does the trick of truncating the text. But it does not show the "More..." link. Edited May 30, 2013 by kingsinnersoul (see edit history) Link to comment Share on other sites More sharing options...
iLama Posted April 27, 2015 Share Posted April 27, 2015 Hi Vekia, and how to do it on 1.6.0.14 version ? please the : {if $key=="description"}{$tr.$key|substr:0:25} .............. thx for answer Link to comment Share on other sites More sharing options...
Recommended Posts