Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

first name only in reviews


Guest

Recommended Posts

I'd like only first names to appear in reviews. I saw there was a mod for it. However the first and last names still appeared. What files would I like to change? I am assuming I'd need to have: customers_firstname instead of customers_name

Link to comment
Share on other sites

Edit product_reviews.php and find the code:

$reviews['customers_name']

 

and change it to be:

substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ')

 

and that will output only the firstname.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Besides product_reviews.php,

 

also make the change in:

 

reviews.php and

product_reviews_info.php

 

In product_reviews_info.php use

substr($review['customers_name'], 0, strpos($review['customers_name'], ' ')

 

(difference is $review instead of $reviews, just for that file)

 

I tried that and it worked :thumbsup:

 

 

Grrrr...still shows first and last names :(

http://thefertilityshop.com/catalog/reviews.php?page=1

Link to comment
Share on other sites

Good call Mark and thanks for the help! ;)

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Hi,

 

Thanks for sharing this great tip!

I easily changed the text in product_reviews.php & reviews.php. However, when I changed product_reviews_info.php I got this error:<br> Parse error: parse error, unexpected ';' in /home/theoccas/public_html/Gift/catalog/product_reviews_info.php on line 93

I did change the 'reviews' to 'review'. Any suggestions?

 

Thanks so much!!!

 

Amy

Link to comment
Share on other sites

Amy,

 

Here's that whole line from product_reviews_info.php

 

<td class="main"><?php echo '<b>' . sprintf(TEXT_REVIEW_BY, substr($review['customers_name'], 0, strpos($review['customers_name'], ' '))) . '</b>'; ?></td>

 

Let me know if that doesn't fix it.

Link to comment
Share on other sites

Thanks. I'm having this problem...although I may have had it before editing the above, not sure..

 

When I click the reviews button for an item, I get:

 

Parse error: syntax error, unexpected ';' in /usr/home/tfs/public_html/catalog/product_reviews.php on line 113

 

 

Here is my coding for that page:

 

 

<?php

/*

$Id: product_reviews.php,v 1.47 2003/02/13 03:53:19 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// lets retrieve all $HTTP_GET_VARS keys and values..

$get_params = tep_get_all_get_params();

$get_params_back = tep_get_all_get_params(array('reviews_id')); // for back button

$get_params = substr($get_params, 0, -1); //remove trailing &

if (tep_not_null($get_params_back)) {

$get_params_back = substr($get_params_back, 0, -1); //remove trailing &

} else {

$get_params_back = $get_params;

}

 

$product_info_query = tep_db_query("select pd.products_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS . " p on pd.products_id = p.products_id where pd.language_id = '" . $languages_id . "' and p.products_status = '1' and pd.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

if (!tep_db_num_rows($product_info_query)) tep_redirect(tep_href_link(FILENAME_REVIEWS));

$product_info = tep_db_fetch_array($product_info_query);

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_REVIEWS);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCT_REVIEWS, $get_params));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

<script LANGUAGE="JavaScript1.2" SRC="includes/menu_animation.js"></SCRIPT>

 

 

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<?php require(DIR_WS_INCLUDES . 'coolmenu.php'); ?>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="0" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top" class="myside"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf(HEADING_TITLE, $product_info['products_name']); ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_reviews.gif', sprintf(HEADING_TITLE, $product_info['products_name']), HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="tableHeading"><?php echo TABLE_HEADING_NUMBER; ?></td>

<td class="tableHeading"><?php echo TABLE_HEADING_AUTHOR; ?></td>

<td align="center" class="tableHeading"><?php echo TABLE_HEADING_RATING; ?></td>

<td align="center" class="tableHeading"><?php echo TABLE_HEADING_READ; ?></td>

<td align="right" class="tableHeading"><?php echo TABLE_HEADING_DATE_ADDED; ?></td>

</tr>

<tr>

<td colspan="5"><?php echo tep_draw_separator(); ?></td>

</tr>

<?php

$reviews_query = tep_db_query("select reviews_rating, reviews_id, customers_name, date_added, last_modified, reviews_read from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' order by reviews_id DESC");

if (tep_db_num_rows($reviews_query)) {

$row = 0;

while ($reviews = tep_db_fetch_array($reviews_query)) {

$row++;

 

if (($row / 2) == floor($row / 2)) {

echo ' <tr class="productReviews-even">' . "\n";

} else {

echo ' <tr class="productReviews-odd">' . "\n";

}

 

echo ' <td class="smallText">' . tep_row_number_format($row) . '.</td>' . "\n" .

' <td class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, $get_params . '&reviews_id=' . $reviews['reviews_id']) . '">' . substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ') . '</a></td>' . "\n" .

' <td align="center" class="smallText">' . tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</td>' . "\n" .

' <td align="center" class="smallText">' . $reviews['reviews_read'] . '</td>' . "\n" .

' <td align="right" class="smallText">' . tep_date_short($reviews['date_added']) . '</td>' . "\n" .

' </tr>' . "\n";

}

} else {

?>

<tr class="productReviews-odd">

<td colspan="5" class="smallText"><?php echo TEXT_NO_REVIEWS; ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="5"><?php echo tep_draw_separator(); ?></td>

</tr>

<tr>

<td class="main" colspan="5"><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, $get_params_back) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, $get_params) . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>'; ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table><br /></td>

<td width="10%" class="footer">

 </td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Any ideas?

Link to comment
Share on other sites

Amy,

 

Here's that whole line from product_reviews_info.php

 

<td class="main"><?php echo '<b>' . sprintf(TEXT_REVIEW_BY, substr($review['customers_name'], 0, strpos($review['customers_name'], ' '))) . '</b>'; ?></td>

 

Let me know if that doesn't fix it.

 

 

Did that......as I was getting the same error. NOW...no name shows up:

http://thefertilityshop.com/catalog/produc...9&reviews_id=38

 

and if you hit the "back" button on that review, you'll see the snytax error I was talking about......

 

Parse error: syntax error, unexpected ';' in /usr/home/tfs/public_html/catalog/product_reviews.php on line 113

Link to comment
Share on other sites

nnclyn,

 

The problem isn't obvious to me...although I did notice that your file isn't the same as what I'm working with. It's from MS1 ... I'm using the MS2 file and even the unmodified versions of product_reviews_info.php have a number of differences.

 

 

Although I can tell you that somewhere inbetween getting all 3 files edited, I did have 'no name at all' show up, but after I made the changes to all 3 then all was well.

 

 

 

Did that......as I was getting the same error. NOW...no name shows up:

http://thefertilityshop.com/catalog/produc...9&reviews_id=38

 

and if you hit the "back" button on that review, you'll see the snytax error I was talking about......

 

Parse error: syntax error, unexpected ';' in /usr/home/tfs/public_html/catalog/product_reviews.php on line 113

Link to comment
Share on other sites

Your error is with:

substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ') . '</a></td>'

You need to add a closing paren to the end of the substr argument list.

substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ')) . '</a></td>'

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Your error is with:

substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ') . '</a></td>'

You need to add a closing paren to the end of the substr argument list.

substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ')) . '</a></td>'

 

 

Thanks :) However...now I get this upon hitting the back browser:

Parse error: syntax error, unexpected '/' in /usr/home/tfs/public_html/catalog/product_reviews.php on line 109

 

And still it's either first and last name in the reviews..or nothing...

Link to comment
Share on other sites

I just downloaded the page and added the ending paren and it works fine for me. There is no parse error and only the first name is displayed in the review listing.

 

If you have selected a specific review to look at, then you need to edit the product_reviews_info.php file, as can be evidenced by the url. In that case, you need to follow Mark's advice above.

 

 

Thanks :) However...now I get this upon hitting the back browser:

Parse error: syntax error, unexpected '/' in /usr/home/tfs/public_html/catalog/product_reviews.php on line 109

 

And still it's either first and last name in the reviews..or nothing...

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

  • 1 month later...
Amy,

 

Here's that whole line from product_reviews_info.php

 

<td class="main"><?php echo '<b>' . sprintf(TEXT_REVIEW_BY, substr($review['customers_name'], 0, strpos($review['customers_name'], ' '))) . '</b>'; ?></td>

 

Let me know if that doesn't fix it.

 

I am getting no name at all when I do the above :(

Link to comment
Share on other sites

Thank you, Jim! I think I will put that to use too :)
Thanks Jim (Daemonj) and Mark (choosealogin), this is eaxctly what I needed. one more thig, if you wanted to add customer city from Table_address_book entry_city , how would you modify $reviews_query_raw and pertinent files?
Link to comment
Share on other sites

below is a recap of what to comment out and add to show just first name in reviews:

 

in catalog/reviews.php

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $reviews['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '"><u><b>' . $reviews['products_name'] . '</b></u></a> <span class="smallText">' . sprintf(TEXT_REVIEW_BY, /* tep_output_string_protected(  $reviews['customers_name'] */ substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ') )) . '</span>'; ?></td>

in catalog/product_reviews.php

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $product_info['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '"><u><b>' . sprintf(TEXT_REVIEW_BY, /* tep_output_string_protected( $reviews['customers_name'] */ substr($reviews['customers_name'], 0, strpos($reviews['customers_name'], ' ') )) . '</b></u></a>'; ?></td>

in catalog/product_reviews_info.php

<td class="main"><?php echo '<b>' . sprintf(TEXT_REVIEW_BY, /*tep_output_string_protected(  $review['customers_name'] */ substr($review['customers_name'], 0, strpos($review['customers_name'], ' ') )) . '</b>'; ?></td>

Link to comment
Share on other sites

one more time plz, if you wanted to add customer city from Table_address_book entry_city , how would you modify $reviews_query_raw and pertinent files?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...