Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to control reviews lenght?


dedeman

Recommended Posts

There are a few edits you need to make. In catalog/reviews.php find

  $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 from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id DESC";

Change the 100 in the part below to what you need.

left(rd.reviews_text, 100) as reviews_text,

Find

					<td valign="top" class="main"><?php echo tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>') . ((strlen($reviews['reviews_text']) >= 100) ? '..' : '') . '<br><br><i>' . sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</i>'; ?></td>

This part says how many characters to display before inserting a break. Change 60 to what you need.

tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>')

This part says how many characters to display before adding " .. " to the end of the review. Change 100 to the same number that is in the query string above.

((strlen($reviews['reviews_text']) >= 100) ? '..' : '')

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...