Change the lenght of the product description in opencart listing

Posted by Flo on 09 May 2013

I have noticed a lot of people enquiring about this so Ill post  an easy and short solution to it.

Just for clarification I am reffering to the short description each product has when you view it in a category page or search page in list mode. Another thing you should know is that the short description is a text excerpt limited by default to 100 characters from the beggining of a product's main description. It is only text, and the reason for which the html tags are subtracted is because if they werent, they could mess up the page layout (the main description is html code and if it gets broken after 100 characters or more you might end up with unclosed tags the would mess up the other items below or the hole page layout, or another cause is that if the tags werent subtracted they would also be counted as characters and you would have uneven short descriptions for products or no short description for some). If you wish to have a full html short description for products, you can get one of the extensions on or keep posted for an alternative solution on this blog soon.

Back to the modification. Edit the files catalog/controller/product/category.php, search.php, special.php and manufacturer.php (these are the 4 listing instances where you have the short description).

In each of those files find the code:

'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',

And in that code change the red bolded number to the number of characters you wish to display.