Kristofor Posted July 14, 2003 Share Posted July 14, 2003 hi guys, i was trying this code in my new products/featured products box, to display a random review and rating about my product, however this is not showing any reviews all it displays is Rating : this is the code <?php $reviews = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'"); $reviews_values = tep_db_fetch_array($reviews); ?> <tr> <td class="main" valign="top"><b>Reviews:</b></td> <td class="main"> <?php if ($reviews_values['count'] > 0) { echo '<a class="main" href="'; echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)) .'">'; echo 'Reviews:' . ' ' . $reviews_values['count']; echo '</a> | '; echo '<a class="main" href="'; echo tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, substr(tep_get_all_get_params(), 0, -1)) . '">'; echo 'Write a review'; echo '</a>'; $random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 150) as reviews_text, r.reviews_rating, p.products_id, r.date_added, r.customers_name 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); if ($random_product) { // display random review box echo '<br><br>Rated:' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])); echo 'by ' . $random_product['customers_name']; $review = htmlspecialchars($random_product['reviews_text']); echo '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id'], 'NONSSL') . '">' . $review . '....</a></i>'; } } ?> </td> </tr> what would be the problem with that???? because it doesnt work, someone help me thanks kristofor Don't die with the music in you!!! Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.