Page 1 of 1

How to get line break from text in categories?

Posted: Thu Feb 19, 2015 5:34 pm
by kungmats
As topic says ...

If I enter the text for a product like:
ABC
123

It shows like ABC123 on category pages. How can that be fixed?

Re: How to get line break from text in categories?

Posted: Fri Feb 20, 2015 2:58 am
by BrettMW
Hi kungmats,

Make sure you are not editing in HTML mode. You can toggle this by clicking the icon as highlighted in the image below
Image

If it still won't work, try using "<br />" instead of a new line, for example:

Code: Select all

ABC<br />123

Re: How to get line break from text in categories?

Posted: Fri Feb 20, 2015 3:17 pm
by kungmats
Thank you but this is not the problem.
On the product page it looks ok, it's just on tha category pages line break does not work.

I've tryed to change though to <br /> instead of <br> but it does not matter

Re: How to get line break from text in categories?

Posted: Fri Feb 20, 2015 3:19 pm
by yodapt
Do you have a url?

Re: How to get line break from text in categories?

Posted: Fri Feb 20, 2015 3:35 pm
by kungmats
All products on the page, and I have the same problem with standard theme and this milano I use now

The url is changed to
http://maddy.se/

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 4:34 am
by BrettMW
Which OpenCart version are you using?

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 5:10 am
by kungmats
2.0.1.1

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 8:24 am
by BrettMW
Try editing in HTML mode and putting <br /> in where you want a line break.

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 8:58 am
by kungmats
I did as you can see above.
that does not help and besides, the text shows correct on the product pages. This problem is only on the category pages

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 1:44 pm
by BrettMW
I see what you mean now.

OpenCart removes HTML tags for the product description on the category pages. The reason for this is that it has to take a sub-string of the description (it doesn't display the whole thing on the category page), and if there are HTML tags in there it would likely break the HTML causing it to look horrific.

Therefore the new lines or paragraphs that you put in the description are removed. IMO the best way to fix this is to have descriptions that do not have a new line near the beginning to eliminate the problem.

Re: How to get line break from text in categories?

Posted: Sat Feb 21, 2015 4:16 pm
by kungmats
Ok, but there has to be a file where I can ad like $text = nl2br($text) to fix this, but i cant find where

Re: How to get line break from text in categories?

Posted: Sat Sep 19, 2015 1:34 am
by sully210
Has anyone found a fix for this problem? I need to be able to have short descriptions and line breaks. Nothing seems to work and I need help fast. My descriptions shows fine on my product page but in one line and un-formatted on my category page. Here is a link to my category page: http://chestersbbq.com/orders/index.php ... ry&path=20
and here is a link to my product page: http://chestersbbq.com/orders/index.php ... duct_id=50
Why does this happen and how can I fix it?
Thanks for any help.