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