Forums / Templates, Stylesheets, Page Layout / How to hide customers last names in product reviews?

How to hide customers last names in product reviews?

Started by joyjoy on 7 Dec 2010, 8:46 AM · Views: 1,414

Results 1 to 14 of 14
7 Dec 2010, 8:46 AM
#1
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

How to hide customers last names in product reviews?

Can anyone help me, I'm trying to hide the customers last names when a review is posted. I found a post for this a while back...but I can't seem to locate it.

This is the code that I currently have in the tpl_product_reviews_default.php

<div class="productReviewsDefaultReviewer bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($reviews->fields['date_added'])); ?> <?php
list($review_first_name, $review_last_name) = split(' ', zen_output_string_protected($reviews->fields['customers_name']));$last_name_array = str_split($review_last_name,1); echo sprintf(TEXT_REVIEW_BY, $review_first_name).' '.$last_name_array[0].'.'; ?></div> 

This hides the entire name and only "." is visible. :wacko:

8 Dec 2010, 6:48 PM
#3
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

When I tried the suggestions from this forum, it still doesn't work...unless I'm doing something wrong?

Can someone...anyone help??

8 Dec 2010, 6:50 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide customers last names in product reviews?

Are you having problems with NEW Reviews or OLD, existing Reviews? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Dec 2010, 7:08 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide customers last names in product reviews?

I think if you used the correct variable:
$reviews['customersName']

rather than:
$reviews->fields['customers_name']

you would get further along on this ... :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Dec 2010, 7:16 PM
#6
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

It's with an existing review.

I will try to use your suggestion and see if that makes a difference.

Thank you so much for answering. I've asked several times but I don't get any responses. I appreciate it.

8 Dec 2010, 9:30 PM
#7
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

Okay, I made the change...but I'm not sure if I did it correctly. Here is the new code

<div id="reviewsInfoDefaultMainContent" class="content"><?php echo zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_info->fields['reviews_text']))), 60, '-<br />'); ?></div>
<div id="reviewsInfoDefaultDate" class="bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php
list($review_first_name, $review_last_name) = split(' ', zen_output_string_protected($reviews->['customersName']));
$last_name_array = str_split($review_last_name,1);
echo sprintf(TEXT_REVIEW_BY, $review_first_name).' '.$last_name_array[0].'.'; ?></div>

It didn't make any difference. Both first and last names are still visible.

8 Dec 2010, 10:24 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide customers last names in product reviews?

Getting closer ...

Could you use:
$reviews['customersName']

instead of:
$reviews->['customersName']

Check all references in your code ... you are mixing in the ->fields and -> and $review_info in there when it should be $reviews[ ...

You cannot just make these up as you go along ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Dec 2010, 10:41 PM
#9
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

Oh okay so I remove "fields" from the code? I got this code off of the forum, but it's from 2008 so I guess it's outdated. It seems to have worked for the other users at that time.

8 Dec 2010, 11:56 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide customers last names in product reviews?

old code ... this could be a hint ...

Look at a clean copy of the template file you are trying to change and do a search on:
$review

Look at how it is referenced in the file to see how to call the various components ...

If the original Customer Name is referenced as:
$reviews['customersName']

you need to reference it the same way:
$reviews['customersName']

you cannot change that to:
**$reviews->fields['customersName']

$reviews->['customersName']

$reviews['customers_name']
**

all of those wrong methods will have the value of:
nothing ... :eek:

So if you are looking at example code:

<div class="productReviewsDefaultReviewer bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($reviews->fields['date_added'])); ?> <?php
list($review_first_name, $review_last_name) = split(' ', zen_output_string_protected($reviews->fields['customers_name']));$last_name_array = str_split($review_last_name,1); echo sprintf(TEXT_REVIEW_BY, $review_first_name).' '.$last_name_array[0].'.'; ?></div>

you need to transpose the wrong code with the right code values from the original code:

<div class="productReviewsDefaultReviewer bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($reviews['dateAdded'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($reviews['customersName'])); ?></div>

Old values:

$reviews->fields['date_added']
$reviews->fields['customers_name']

New values:

$reviews['dateAdded']
$reviews['customersName']

Now, carefully ... go try again, using the new values that match your template file that you are trying to change ... you will get this right ... even if just by accident, eventually ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 Dec 2010, 12:08 AM
#11
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

Wow, now I get it. I've installed the reviews by guests add on and the coding is littered with the wrong reference. But everything was working properly. The only thing I could not figure out was how to hide the customer's last names on a posted review...

Well at least I know where to start on this now. Thank you.

9 Dec 2010, 12:28 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide customers last names in product reviews?

Keep in mind ... every page can have different references ... so be sure you are utilizing the correct ones for the file that you are in ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Jan 2011, 6:00 PM
#13
shanesoine avatar

shanesoine

Zen Follower

Join Date:
May 2010
Posts:
125
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

Hi I am also struggling with this. Using 1.3.9f and code reads:

<div id="reviewsInfoDefaultMainContent" class="content"><?php echo zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_info->fields['reviews_text']))), 60, '-<br />'); ?></div> <div id="reviewsInfoDefaultDate" class="bold"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($review_info->fields['date_added'])); ?> <?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($review_info->fields['customers_name'])); ?></div> </div>

so how would I go about getting rid of the surname in a review.

I have tried all the suggestions mentioned in the forum to no avail and do not have any review mods installed.

Many thanks Shane

4 Jan 2011, 4:34 PM
#14
neilw avatar

neilw

New Zenner

Join Date:
Jan 2009
Posts:
16
Plugin Contributions:
0

Re: How to hide customers last names in product reviews?

...or just go into phpMyAdmin and edit the name field in the database as you like. Works fine when you don't have a lot of reviews. Customer name is held as a populated field so can be modified once it is entered.