Post by debbiekipt » Fri Apr 29, 2016 5:56 pm

Hi
We get some long reviews and notice the line breaks are stripped.
It looks like they are there when reviewing in Admin, but on publishing the line breaks are all gone, making larger portions of text, hard to read and not very attractive to view.

I found an old post on this but the code given is not in the file in 1.5.6.4
JAY6390 wrote:In

Code: Select all

/catalog/model/catalog/review.php
find this

Code: Select all

$this->db->escape(strip_tags($data['text'])) 
and replace with

Code: Select all

$this->db->escape(nl2br(strip_tags($data['text']))) 
and see if that does it
http://forum.opencart.com/viewtopic.php?f=20&t=17324

Can anyone kindly let me know how to get the line breaks to work so the text looks better in 1.5.6.4?

Many thanks in advance!

Active Member

Posts

Joined
Sun Nov 21, 2010 8:10 pm

Post by IP_CAM » Fri Apr 29, 2016 10:06 pm

sure it is, just check the
admin/model/catalog/review.php
line 4:

Code: Select all

text = '" . $this->db->escape(strip_tags($data['text'])) . "',
Line 10:

Code: Select all

text = '" . $this->db->escape(strip_tags($data['text'])) . "',
and in:
catalog/model/catalog/review.php
it's this line:

Code: Select all

text = '" . $this->db->escape($data['text']) . "',
but this one does not even have/use a strip_tags Filtering-Command in it, a REGEX Function, usually added, to remove html/code TAGS, such as this:
<br />
meaning, that, after you modified the Admin File, and changed the Content, by adding some <br/> TAG,
it possibly would display, in the visitor Section, including such working NEW LINE <br /> tag-commands.

strictly theoretically :D , but OSWorx seems to be 'invisible' around here for a good while already, he cannot confirm, and I never yet made any Tests with Review Stuff.
Files checked: OC v.1.5.6.5_rc, should be identical with v.1.5.6.4 !
Good Luck ;)
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'750 FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by debbiekipt » Sat Apr 30, 2016 10:06 pm

Hi Ernie and thanks so much for your reply and help on this!

The original post pointed us to catalogue, not admin folder and as you point out it is different in the catalogue folder :-)

As a non coder, I was only looking for exact copy and in the exact location, but I am delighted to report after making the change just in the admin folder the line breaks work!! :-D

I made no change to the file in catalogue, just the one in admin in the places you cited and it works for me.

I am not sure if that will be causing a problem in the db as OSworx seemed to say it was the wrong thing to add nl2br to the db?

Would you know if it would?
I hope not as it is doing what I wanted front end

Many thanks again!

Active Member

Posts

Joined
Sun Nov 21, 2010 8:10 pm

Post by IP_CAM » Sun May 01, 2016 12:22 am

Good for You ! They must have removed this FILTER from the Cat-Section File, but still left it in the admin File, at least in my latest Version 1.5.6.5_rc, if it existed before, possibly in both. But it will disable tags, entered into INPUT, to be saved, as I at least understand the usual function of this Regex. But it could be, that OC handles it in a different way, like so many things, I was used to, before.... 8)

But I really don't know, from what I found:
></p>\r\n<
<br />\r\n
in a sample DB, I find many Entrie's, i.E. in category Descriptions, where return/new-Line TAGS do exist.
So, why should such not work in any place? BUT, when it comes to this, I am just a Newbie. After ~20 years
of flat-file db-handling/coding, I am happy already, I am able to add some MySql-DB 'Content' to existing Lines... :D

Trail and Error, it's the only way to find out. Create one, then download your DB Content, and check in the Review Section, how it has been saved. And only, if it would look like <br><p>, then, you could have a problem, otherways, I cannot see one, if all tags are beeing 'translated' into this &...; / \r / \n - way of doing this correctly.
It's still old typewriter style Code, actually, Carriage return, new Line... go! :D
Good Luck ;)
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'750 FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 33 guests