Latest Articles
So far this was never an issue, there were problems with uploading modules via the installer because of the ftp connection but you could allways install ocmods without any issue. However, some .. Read More
People had this issue so many times I thought I would write a bit about it. The  types of issues with opencart's 2.x modification system that I identified so far are: 1. Old Vqmod .. Read More
This small tutorial will show you how to manually add custom links to the default top menu in opencart. If you dont want to go trough all the hustle and would like to be able to completly customize.. Read More
To enable seo urls in opencart navigate in admin to system > settings , edit the store and on the server tab of the store settings you will find "Use SEO urls", set it to yes. So far e.. Read More
All Articles

Change the lenght of the product description in opencart listing

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

Posted by Flo

9 Comments To "Change the lenght of the product description in opencart listing"

hasan On 05 Sep 2017
Hi This is Eyup and i am newbie about php and bit of opencart. I am using 2.1.0.2 Version of opencart.I can add til 265 character on product name I want to know how to add character restriction on product name while listing new products even add character remaining info when adding products. can any one has knowledge about this situation. Thank you Reply to this comment
Rumen Georgieff On 10 Mar 2016
Do you know how to do this in opencart 2? The code there is 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..', Reply to this comment
Flo On 10 Mar 2016
In opencart 2.x there is setting in admin for description length, you dont need to modify code.
Flo On 05 Feb 2015
To delete it only in those modules, edit their coresponding tpls (latest.tpl, special.tpl, bestsellert.tpl, featured.tpl) and from within them delete the line with the description word in it. Reply to this comment
Asim On 05 Feb 2015
I want to remove featured, latest, latest by category, special product description at home page in open cart version 2.0.1.1. I just want to show only product name, image, price, add to cart, add to wish list and compare. can any one help me to this problem? Thanks in advance. Reply to this comment
Michael On 26 Sep 2014
ALWAYS, ALLWAYS write OC version !! Reply to this comment
Amir On 17 Jun 2014
Thanks great for your efforts Reply to this comment
Mário On 07 Jan 2014
Same as Chris... Thank you so much! finnaly a quick fix! Reply to this comment
Chris On 31 Dec 2013
Thank you so much! finnaly a quick fix! did not expect it was seperated, happy with the full control on lengt on diffrent pages. Thanks a bunch! Reply to this comment

Write a comment

Your Name:


Enter the code in the box below:

Your Comment:
Note: HTML is not translated!