Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Reviews Box Error


Guest

Recommended Posts

Suddenly, my Reviews Box stopped displaying the reviews. There has been no updates or changes to the site. And the review data has been verified in the DB. If I'm looking at the products page. And I click the Review Button - I can see all the reviews. But for some reason the review box never shows anything.

 

I've also noticed that the product ID is not getting passed into the URL for the arrows, at the top of the box. Where it should say something like "../product_reviews.php/products_id/81".

 

Instead it is now saying "../reviews.php" for the URL of the arrows.

 

Any advice would be greatly appreciated.

Link to comment
Share on other sites

Suddenly, my Reviews Box stopped displaying the reviews. There has been no updates or changes to the site. And the review data has been verified in the DB. If I'm looking at the products page. And I click the Review Button - I can see all the reviews. But for some reason the review box never shows anything.

 

I've also noticed that the product ID is not getting passed into the URL for the arrows, at the top of the box. Where it should say something like "../product_reviews.php/products_id/81".

 

Instead it is now saying "../reviews.php" for the URL of the arrows.

 

Any advice would be greatly appreciated.

 

is it in the main store or in your admin? if it is in the main store could you give me the url?

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

is it in the main store or in your admin? if it is in the main store could you give me the url?

 

Hey, thanks for the responses...

 

www.k9power.com/catalog

 

Please note - this store is live.

Link to comment
Share on other sites

check if disabling the search engine friendly urls from your osc admin makes a difference.

 

Hello enigma1 - I've seen many of your posts on this subject. So it is nice to be speaking with you.

 

I have disabled the Search Engine Friendly urls. No change however.

 

Here's a shortcut to a product page that has 5 reviews:

http://www.k9power.com/catalog/product_inf.../products_id/81

 

Thanks for the help from both of you. I really appreciate any and all efforts.

Link to comment
Share on other sites

in your osc admin->Configuration->Max Values do you have sensible values for the reviews? Or these are left to 0.

 

In Max Values - I have the following:

New Reviews - 6

Selection of Random Reviews - 200

Link to comment
Share on other sites

ok in your catalog\includes\boxes\reviews.php backup the file then

 

find:

$rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br>');

 

change it to

$rand_review_text = 'Test String<br>';

 

See if this simple string shows up.

Link to comment
Share on other sites

ok in your catalog\includes\boxes\reviews.php backup the file then

 

find:

$rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br>');

 

change it to

$rand_review_text = 'Test String<br>';

 

See if this simple string shows up.

 

I don't have that exact code in my file - what I have is this:

$review = htmlspecialchars($random_product['reviews_text']);

$review = tep_break_string($review, 15, '-<br>');

 

I tried replacing with your code. No luck.

My file is V 1.30 - If you'd like I can post the entire file here. As I know it is a slightly old version of the reviews.php file.

Link to comment
Share on other sites

I don't have that exact code in my file - what I have is this:

$review = htmlspecialchars($random_product['reviews_text']);

$review = tep_break_string($review, 15, '-<br>');

 

I tried replacing with your code. No luck.

My file is V 1.30 - If you'd like I can post the entire file here. As I know it is a slightly old version of the reviews.php file.

go here

http://www.oscommerce.com/solutions/downloads

get the latest archive and try the default reviews box file. See if it makes a difference.

Link to comment
Share on other sites

ok post your reviews box file.

 

<?php

/*

$Id: reviews.php,v 1.30 2002/01/09 17:19:25 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- reviews //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => BOX_HEADING_REVIEWS);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_REVIEWS, '', 'NONSSL'));

 

if ($HTTP_GET_VARS['products_id']) {

$random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);

} else {

$random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);

}

 

if ($random_product) {

// display random review box

$review = htmlspecialchars($random_product['reviews_text']);

$review = tep_break_string($review, 15, '-<br>');

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => '<div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id'], 'NONSSL') . '">' . $review . ' ..</a><br><div align="center">' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>');

new infoBox($info_box_contents);

} elseif ($HTTP_GET_VARS['products_id']) {

// display 'write a review' box

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBox"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td><td class="infoBox"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table>');

new infoBox($info_box_contents);

} else {

// display 'no reviews' box

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => BOX_REVIEWS_NO_REVIEWS);

new infoBox($info_box_contents);

}

?>

</td>

</tr>

<!-- reviews_eof //-->

Link to comment
Share on other sites

ok backup your file then change this:

 

if ($HTTP_GET_VARS['products_id']) {
$random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
} else {
$random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
}

if ($random_product) {
// display random review box

 

to this

if ($HTTP_GET_VARS['products_id']) {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
} else {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
}

if (tep_db_num_rows($random_product_query) ) {
$random_product = tep_db_fetch_array($random_product_query);
// display random review box

Link to comment
Share on other sites

seems the first "if" to display a review never works. I wonder why if there is something in your database that causes it. Ok simplify the query from the code I posted earlier to see at least if something shows.

 

So instead of this:

if ($HTTP_GET_VARS['products_id']) {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by rand(), r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
} else {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by rand(), r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);
}

 

try this:

$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by rand(), r.reviews_id DESC limit 10");

I simplify it a bit to see if some dbase info is not correct.

Link to comment
Share on other sites

ok lets see which item caused the issue, so backtrack to the previous change that didn't work and slightly modify it.

 

try this code:

if ($HTTP_GET_VARS['products_id']) {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by rand(), r.reviews_id DESC limit 10");
} else {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by rand(), r.reviews_id DESC limit 10");
}

see if that works. The other problem with the reviews arrow is in the catalog\reviews.php seems like a separate issue with the script there.

Link to comment
Share on other sites

ok lets see if review status causes this, so try:

 

if ($HTTP_GET_VARS['products_id']) {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by rand(), r.reviews_id DESC limit 10");
} else {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by rand(), r.reviews_id DESC limit 10");
}

Link to comment
Share on other sites

there is still the product status and product_id

 

so here is the next one.

 

if ($HTTP_GET_VARS['products_id']) {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by rand(), r.reviews_id DESC limit 10");
} else {
$random_product_query = tep_db_query("select r.reviews_id, substring(rd.reviews_text, 1, 60) as reviews_text, r.reviews_rating, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id order by rand(), r.reviews_id DESC limit 10");
}

 

when you say "error" you do not get a php error, you mean the original problem right?

Link to comment
Share on other sites

there is still the product status and product_id

 

.....

 

when you say "error" you do not get a php error, you mean the original problem right?

 

Yes correct, the origional problem.

 

I tried this new code - and it didn't brake the box this time. It is currently up there. And working.

Link to comment
Share on other sites

ok this means the product's status is off so the query did not find anything. Have you customized your store about it? The product's status by default indicates whether the product is listed in the catalog or not.

Link to comment
Share on other sites

ok this means the product's status is off so the query did not find anything. Have you customized your store about it? The product's status by default indicates whether the product is listed in the catalog or not.

 

Hello enigma1 - sorry for the delay. I have been very busy lately, and just found time to get back to this.

 

To answer your question: No the products status has not been changed, and is on. The only action that has taken place, was the addition of a few reviews. At that time, the problem was first seen.

 

:huh:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...