Zen Cart Logo
Forums / General Questions / Length of Text Displayed on Customer Reviews Page

Length of Text Displayed on Customer Reviews Page

Locked

Views: 3,619

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
19 Sep 2009, 4:46 PM
#1
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Length of Text Displayed on Customer Reviews Page

If you look at my reviews page here:

http://www.limelites.co.uk/index.php?main_page=reviews

you'll see that a lot of the review texts are cut short and truncated. Is there a simple way to increase the length of characters that's allowed on this page, so that the entire text is displayed in each review? There is certainly enough space.

19 Sep 2009, 5:57 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Length of Text Displayed on Customer Reviews Page

in includes/templates/yourtemplate/templates/tpl_reviews_default.php fin the line:

<div class="content"><?php echo zen_break_string(nl2br(zen_output_string_protected(stripslashes($reviews->fields['reviews_text']))), 60, '-<br />') . ((strlen($reviews->fields['reviews_text']) >= 100) ? '...' : ''); ?></div> 

About line 43.

It is the 60 and the 100 that you are interested in. The 60 is the length of the string and the 100 is where it decides to put the ... in.

19 Sep 2009, 6:02 PM
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Length of Text Displayed on Customer Reviews Page

But if you want the whole thing try :

<div class="content"><?php echo nl2br(zen_output_string_protected(stripslashes($reviews->fields['reviews_text'])))?></div>  
19 Sep 2009, 6:03 PM
#4
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Length of Text Displayed on Customer Reviews Page

Thanks for the reply.... I changed the 60 to 600 and the 100 to 1000, but now insterad of the .... it just cuts off the review, dead.

19 Sep 2009, 6:12 PM
#5
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Length of Text Displayed on Customer Reviews Page

niccol:

But if you want the whole thing try :

<div class="content"><?php echo nl2br(zen_output_string_protected(stripslashes($reviews->fields['reviews_text'])))?></div> ```

Nope, that does the same thing, just cuts the review text off dead. So where the '...' once was there's just nothing, but it still doesn't show the full text.

19 Sep 2009, 6:23 PM
#6
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Length of Text Displayed on Customer Reviews Page

I'd need to add something to the code that allows the review to take up multiple lines... increasing the 100 to 10000 seems to get rid of the '...' but still doesn't allow the full review to display.

19 Sep 2009, 7:37 PM
#7
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Length of Text Displayed on Customer Reviews Page

Sorry. It seems to be done in the sql query as well. So, stick to my final version and have a look at:

includes/modules/pages/reviews/header_php.php

Have a look at line 17 ```
$reviews_query_raw = "SELECT r.reviews_id, left(rd.reviews_text, 100) AS reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name


which truncates the reviews_text to 100.  Works for me....
19 Sep 2009, 7:51 PM
#8
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Length of Text Displayed on Customer Reviews Page

And now that I have actually looked at what zen_break_string actually does I will take back what I originally said.

I made an assumption that it truncated the string after a certain number of characters. It doesn't. Ah, assumptions, mother of all ####-ups.

What it does is split up very long words to allow for word wrap and so that they don't break the layout. So, if a word is longer than 60 characters in the review it will break it up.

So, go back to the original version of the tpl_reviews_default file and make the edits I have suggested to the header_php.php file. You will want to put some limit in on this file (let's say 2000).

All that means is that in the tpl_reviews_default file you would want to change the 100 to 2000.

Sorry for messing you around. There is some phrase that involves assumptions making an ###### of u but I can't remember it now.

20 Sep 2009, 1:40 AM
#9
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Length of Text Displayed on Customer Reviews Page

Hi Niccol,

You got it though....header_php.php........ line 17, changed rd.reviews_text, from 100 to 10000 and now thef full review text shows :-) Thank you for helping me out, I owe you one....... :hug:

26 Dec 2009, 7:15 PM
#10
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Length of Text Displayed on Customer Reviews Page

I have changed the number from 100 to 10000 in

includes/modules/pages/reviews/header_php.php

and in

includes/templates/yourtemplate/templates/tpl_reviews_default.php

but still the reviews are truncated :no:

Im using Zen Cart 1.3.8a. Anybody got this working? or knows how to get it working? Any help is much appreciated.

12 Jan 2010, 3:52 PM
#11
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Length of Text Displayed on Customer Reviews Page

The changes shown here do work, but on the reviews page (tpl_reviews_default.php) the reviews are shown complete, but not on products page which is the problem the majority have.

To solve this make the same final changes to the other review pages, which are:
includes/modules/pages/reviews/header_php.php
includes/templates/yourtemplate/templates/tpl_reviews_default.php

Hope this helps.